Skip to content

AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() overrides values it should not [SPR-11649] #16272

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

  1. 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:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions