Closed
Description
Ilian Iliev opened SPR-11649 and commented
Status Quo
I have the following class with 2 annotations:
@VsoFinder(name="some_name", ...)
@VsoObject(name="another_name", ...)
public class SomeClass { /* ... */ }
In my app, there is the following call:
Map<String, Object> attributes = annotMetadata.getAnnotationAttributes(VsoObject.class.getName());
I'd expect this call to return the attributes/values defined in the @VsoObject
annotation, and it worked fine in Spring versions up to 4.0.2. However, due to the changes introduced in conjunction with #16198 in Spring 4.0.3 the returned values are those coming from the @VsoFinder
annotation.
A quick look at AnnotationReadingVisitorUtils.getMergedAnnotationAttributes()
confirms that indeed the values of attributes with the same name are overridden with the values from annotations of any type, not only from the requested annotation type.
Deliverables
- Ensure that
AnnotationReadingVisitorUtils.getMergedAnnotationAttributes()
only overrides attributes in the target annotation with attributes from annotations that are annotated with the target annotation.
Affects: 4.0.3
Issue Links:
- Support meta-annotation attribute overrides in ASM-based annotation processing [SPR-11574] #16198 Support meta-annotation attribute overrides in ASM-based annotation processing
- AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() mutates the map argument [SPR-11710] #16332 AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() mutates the map argument
- Consider not overriding meta-annotation attributes if empty [SPR-11709] #16331 Consider not overriding meta-annotation attributes if empty