Introduce support for explicit annotation attribute overrides [SPR-11513] #16138
Closed
2 of 3 tasks
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Sam Brannen opened SPR-11513 and commented
Status Quo
The Spring Framework provides support for meta-annotation attribute overrides in custom composed annotations. However, as of Spring 4.0, such overrides are only supported for attributes with names other than
value
, and the overriding attribute must have the exact same name and type as the attribute it overrides.If multiple meta-annotations are used to compose the custom annotation, and if these meta-annotations declare attributes of the same name and type (e.g.,
String name() default "";
), then there is a conflict. In such scenarios:Furthermore, it is currently impossible to override a
value
attribute from a meta-annotation.Deliverables
@AliasFor
annotation introduced in Introduce unified support for declaring and looking up annotation attribute aliases [SPR-11512] #16137.AnnotationUtils
andAnnotatedElementUtils
so that they honor this new annotation.Proposals for Annotation Name
@OverridesMeta
@MetaAnnotationAttribute
@AnnotationAttributeMapping
Example: Overriding Multiple
value
AttributesThe following example demonstrates how to:
value
attributevalue
)Example: Overriding Attribute With Custom Name
Affects: 4.0 GA
Issue Links:
The text was updated successfully, but these errors were encountered: