-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Allow a single element to override an array attribute in a meta-annotation [SPR-13972] #18544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sam Brannen commented Juergen Hoeller, the committed change only works for reading such attributes via the When attempting to use this feature with synthesized annotations (e.g., a merged
I have been planning on adding such support for synthesized annotations. So, do you want me to reopen/repurpose this issue or create a separate one to address this? Cheers, Sam |
Juergen Hoeller commented Let's reopen this one for the wider purpose in the 4.3 timeframe. I only really sneaked it in since I ran into it when coding a recent unit test :-) Juergen |
Sam Brannen commented OK. I'm reopening this issue and assigning it to me in order to address annotations synthesized from maps. |
Sam Brannen commented Current work can be viewed in the following branch: https://github.com/sbrannen/spring-framework/commits/SPR-13972 |
Sam Brannen commented Pushed to |
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 singleString
value.Deliverables
findMergedAnnotationAttributesWithSingleElementOverridingAnArrayViaConvention()
inAnnotatedElementUtilsTests
.@AliasFor
.findMergedAnnotationAttributesWithSingleElementOverridingAnArrayViaAliasFor()
inAnnotatedElementUtilsTests
.AnnotationAttributes
(which is assumed to already be the case but should be verified).singleElementToSingleElementArrayConversionSupport()
inAnnotationAttributesTests
.getMergedAnnotation*WithSingleElementOverridingAnArrayVia*()
andfindMergedAnnotationWithSingleElementOverridingAnArrayVia*()
methods inAnnotatedElementUtilsTests
.Affects: 4.2.4
Issue Links:
@RequestMapping
("is depended on by")@Configuration
classes@RequestMapping
The text was updated successfully, but these errors were encountered: