Closed
Description
Juergen Hoeller opened SPR-13972 and commented
Overview
In 4.2, aliased annotation attribute types must match exactly. However, it is rather common in Java for single element values to be specified for an array attribute: Reflecting this in custom annotation design, it would be nice for a custom annotation to be able to declare a single element only, aliasing a meta-annotation attribute which was originally declared as an array, e.g. in a custom @PropertySource
variant with a single String
value.
Deliverables
- Allow for a single element overriding an array attribute in a meta-annotation by convention.
- See
findMergedAnnotationAttributesWithSingleElementOverridingAnArrayViaConvention()
inAnnotatedElementUtilsTests
.
- See
- Allow for a single element overriding an array attribute in a meta-annotation using
@AliasFor
.- See
findMergedAnnotationAttributesWithSingleElementOverridingAnArrayViaAliasFor()
inAnnotatedElementUtilsTests
.
- See
- Ensure that the aforementioned overrides are supported in
AnnotationAttributes
(which is assumed to already be the case but should be verified).- See
singleElementToSingleElementArrayConversionSupport()
inAnnotationAttributesTests
.
- See
- Ensure that the aforementioned overrides are supported in synthesized annotations.
- See various
getMergedAnnotation*WithSingleElementOverridingAnArrayVia*()
andfindMergedAnnotationWithSingleElementOverridingAnArrayVia*()
methods inAnnotatedElementUtilsTests
.
- See various
Affects: 4.2.4
Issue Links:
- Introduce common composed annotations for @RequestMapping [SPR-13992] #18565 Introduce common composed annotations for
@RequestMapping
("is depended on by") - Allow the use of custom PropertySource annotations in @Configuration classes [SPR-8963] #13603 Allow the use of custom PropertySource annotations in
@Configuration
classes - Introduce common composed annotations for @RequestMapping [SPR-13992] #18565 Introduce common composed annotations for
@RequestMapping