This is an automated email from the ASF dual-hosted git repository. albumenj pushed a commit to branch 3.2 in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push: new 5d916cd2c1 fix: fix the signature error when using reflection to access the org.springframework.core.annotation.AnnotatedElementUtils#getMergedAnnotation method (#14156) 5d916cd2c1 is described below commit 5d916cd2c10ad3f21290bf25e338261c30cafbad Author: jkoChen <37362859+jkoc...@users.noreply.github.com> AuthorDate: Wed May 8 15:20:54 2024 +0800 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 <jhq0...@gmail.com> --- .../dubbo/config/spring/util/AnnotationUtils.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java index 02771ca121..35c1bfa932 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java @@ -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); } }