From 9738e4886c626145b60baa80a0bd0740246ebf0e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 6 May 2019 10:42:27 -0700 Subject: [PATCH] Use ReflectionUtils to get declared methods Update `StandardAnnotationMetadata` to use `ReflectionUtils` when obtaining declared methods. This update is primarily so that the common method cache can be used. Closes gh-22907 --- .../springframework/core/type/StandardAnnotationMetadata.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java b/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java index 8cbf61d75b..b4ffd55a51 100644 --- a/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java +++ b/spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java @@ -27,6 +27,7 @@ import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.lang.Nullable; import org.springframework.util.MultiValueMap; +import org.springframework.util.ReflectionUtils; /** * {@link AnnotationMetadata} implementation that uses standard reflection @@ -151,7 +152,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements public boolean hasAnnotatedMethods(String annotationName) { if (AnnotationUtils.isCandidateClass(getIntrospectedClass(), annotationName)) { try { - Method[] methods = getIntrospectedClass().getDeclaredMethods(); + Method[] methods = ReflectionUtils.getDeclaredMethods(getIntrospectedClass()); for (Method method : methods) { if (!method.isBridge() && method.getAnnotations().length > 0 && AnnotatedElementUtils.isAnnotated(method, annotationName)) {