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
This commit is contained in:
committed by
Juergen Hoeller
parent
1fa5937834
commit
9738e4886c
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user