fix: fix the signature error when using reflection to access the org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method (#14156)
Fix the problem,the method org.apache.dubbo.config.spring.util.AnnotationUtils#tryGetMergedAnnotation utilizes reflection to access org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation. However, there is a signature mismatch in the method's input parameters, which leads to an inability to retrieve the correct method. Consequently, this results in the failure to obtain the mergedAnnotation. Co-authored-by: Albumen Kevin <jhq0812@gmail.com>
This commit is contained in:
parent
84193247be
commit
5d916cd2c1
|
|
@ -444,21 +444,11 @@ public abstract class AnnotationUtils {
|
|||
(_k) -> ClassUtils.isPresent(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader))) {
|
||||
Class<?> annotatedElementUtilsClass = resolveClassName(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader);
|
||||
// getMergedAnnotation method appears in the Spring Framework 4.2
|
||||
Method getMergedAnnotationMethod = findMethod(
|
||||
annotatedElementUtilsClass,
|
||||
"getMergedAnnotation",
|
||||
AnnotatedElement.class,
|
||||
Class.class,
|
||||
boolean.class,
|
||||
boolean.class);
|
||||
Method getMergedAnnotationMethod =
|
||||
findMethod(annotatedElementUtilsClass, "getMergedAnnotation", AnnotatedElement.class, Class.class);
|
||||
if (getMergedAnnotationMethod != null) {
|
||||
mergedAnnotation = (Annotation) invokeMethod(
|
||||
getMergedAnnotationMethod,
|
||||
null,
|
||||
annotatedElement,
|
||||
annotationType,
|
||||
classValuesAsString,
|
||||
nestedAnnotationsAsMap);
|
||||
mergedAnnotation =
|
||||
(Annotation) invokeMethod(getMergedAnnotationMethod, null, annotatedElement, annotationType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue