diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java index e96cb1f9fd1c..3f015cd67974 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java @@ -433,12 +433,11 @@ private String resolveCorsAnnotationValue(String value) { private static class AnnotationDescriptor { private final A annotation; - private final Annotation source; + private final MergedAnnotation root; AnnotationDescriptor(MergedAnnotation mergedAnnotation) { this.annotation = mergedAnnotation.synthesize(); - this.source = (mergedAnnotation.getDistance() > 0 ? - mergedAnnotation.getRoot().synthesize() : this.annotation); + this.root = mergedAnnotation.getRoot(); } @Override @@ -453,7 +452,7 @@ public int hashCode() { @Override public String toString() { - return this.source.toString(); + return this.root.synthesize().toString(); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java index fd1f041aa831..422be8a156a4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java @@ -612,12 +612,11 @@ private String resolveCorsAnnotationValue(String value) { private static class AnnotationDescriptor { private final A annotation; - private final Annotation source; + private final MergedAnnotation root; AnnotationDescriptor(MergedAnnotation mergedAnnotation) { this.annotation = mergedAnnotation.synthesize(); - this.source = (mergedAnnotation.getDistance() > 0 ? - mergedAnnotation.getRoot().synthesize() : this.annotation); + this.root = mergedAnnotation.getRoot(); } @Override @@ -632,7 +631,7 @@ public int hashCode() { @Override public String toString() { - return this.source.toString(); + return this.root.synthesize().toString(); } }