HandlerMethod skips interface parameter introspection for return value

Fixes #22303
master
Juergen Hoeller 6 years ago
parent 493e9c1ff0
commit 7cc700435b
  1. 36
      spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java

@ -480,26 +480,28 @@ public class HandlerMethod {
Annotation[] anns = this.combinedAnnotations; Annotation[] anns = this.combinedAnnotations;
if (anns == null) { if (anns == null) {
anns = super.getParameterAnnotations(); anns = super.getParameterAnnotations();
for (Annotation[][] ifcAnns : getInterfaceParameterAnnotations()) { int index = getParameterIndex();
int index = getParameterIndex(); if (index >= 0) {
if (index < ifcAnns.length) { for (Annotation[][] ifcAnns : getInterfaceParameterAnnotations()) {
Annotation[] paramAnns = ifcAnns[index]; if (index < ifcAnns.length) {
if (paramAnns.length > 0) { Annotation[] paramAnns = ifcAnns[index];
List<Annotation> merged = new ArrayList<>(anns.length + paramAnns.length); if (paramAnns.length > 0) {
merged.addAll(Arrays.asList(anns)); List<Annotation> merged = new ArrayList<>(anns.length + paramAnns.length);
for (Annotation paramAnn : paramAnns) { merged.addAll(Arrays.asList(anns));
boolean existingType = false; for (Annotation paramAnn : paramAnns) {
for (Annotation ann : anns) { boolean existingType = false;
if (ann.annotationType() == paramAnn.annotationType()) { for (Annotation ann : anns) {
existingType = true; if (ann.annotationType() == paramAnn.annotationType()) {
break; existingType = true;
break;
}
}
if (!existingType) {
merged.add(adaptAnnotation(paramAnn));
} }
} }
if (!existingType) { anns = merged.toArray(new Annotation[0]);
merged.add(adaptAnnotation(paramAnn));
}
} }
anns = merged.toArray(new Annotation[0]);
} }
} }
} }

Loading…
Cancel
Save