diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 565e5055b70a..c169e3a38280 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -1049,16 +1049,16 @@ public static Object getValue(@Nullable Annotation annotation, @Nullable String return null; } try { - Method method = annotation.annotationType().getDeclaredMethod(attributeName); - return invokeAnnotationMethod(method, annotation); - } - catch (NoSuchMethodException ex) { - return null; + for (Method method : annotation.annotationType().getDeclaredMethods()) { + if (method.getName().equals(attributeName) && method.getParameterCount() == 0) { + return invokeAnnotationMethod(method, annotation); + } + } } catch (Throwable ex) { handleValueRetrievalFailure(annotation, ex); - return null; } + return null; } /**