diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java index a001ff2e78..6f3038cbce 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java @@ -1079,12 +1079,10 @@ public class AnnotatedElementUtils { } } - private void overrideAttributes(AnnotatedElement element, Annotation annotation, AnnotationAttributes attributes, - String sourceAttributeName, List targetAttributeNames) { + private void overrideAttributes(AnnotatedElement element, Annotation annotation, + AnnotationAttributes attributes, String sourceAttributeName, List targetAttributeNames) { - Object value = AnnotationUtils.getValue(annotation, sourceAttributeName); - Object adaptedValue = AnnotationUtils.adaptValue(element, value, this.classValuesAsString, - this.nestedAnnotationsAsMap); + Object adaptedValue = getAdaptedValue(element, annotation, sourceAttributeName); for (String targetAttributeName : targetAttributeNames) { attributes.put(targetAttributeName, adaptedValue); @@ -1094,10 +1092,12 @@ public class AnnotatedElementUtils { private void overrideAttribute(AnnotatedElement element, Annotation annotation, AnnotationAttributes attributes, String sourceAttributeName, String targetAttributeName) { + attributes.put(targetAttributeName, getAdaptedValue(element, annotation, sourceAttributeName)); + } + + private Object getAdaptedValue(AnnotatedElement element, Annotation annotation, String sourceAttributeName) { Object value = AnnotationUtils.getValue(annotation, sourceAttributeName); - Object adaptedValue = AnnotationUtils.adaptValue(element, value, this.classValuesAsString, - this.nestedAnnotationsAsMap); - attributes.put(targetAttributeName, adaptedValue); + return AnnotationUtils.adaptValue(element, value, this.classValuesAsString, this.nestedAnnotationsAsMap); } }