Skip to content
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

Support finding repeatable annotations in AnnotatedTypeMetadata #31041

Closed
sbrannen opened this issue Aug 12, 2023 · 0 comments
Closed

Support finding repeatable annotations in AnnotatedTypeMetadata #31041

sbrannen opened this issue Aug 12, 2023 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

AnnotatedTypeMetadata has various methods for finding annotations; however, it currently does not provide explicit support for merged repeatable annotations.

Although it is possible to craft a query for repeatable annotations using the MergedAnnotations API via getAnnotations(), that requires intimate knowledge of the MergedAnnotations API as well as the structure of repeatable annotations.

Furthermore, the bugs reported in #30941 result from the fact that AnnotationConfigUtils attempts to use the existing functionality in AnnotatedTypeMetadata to find repeatable annotations without success.

In light of that, we should introduce a getMergedRepeatableAnnotationAttributes() method in AnnotatedTypeMetadata with dedicated support for repeatable annotations.

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Aug 12, 2023
@sbrannen sbrannen added this to the 6.1.0-M4 milestone Aug 12, 2023
@sbrannen sbrannen self-assigned this Aug 12, 2023
@sbrannen sbrannen changed the title Introduce getMergedRepeatableAnnotationAttributes() in AnnotatedTypeMetadata Support finding merged repeatable annotations in AnnotatedTypeMetadata Aug 12, 2023
@sbrannen sbrannen changed the title Support finding merged repeatable annotations in AnnotatedTypeMetadata Support findin repeatable annotations in AnnotatedTypeMetadata Aug 12, 2023
@sbrannen sbrannen changed the title Support findin repeatable annotations in AnnotatedTypeMetadata Support finding repeatable annotations in AnnotatedTypeMetadata Aug 12, 2023
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Aug 13, 2023
Prior to this commit, Spring failed to find multiple composed
@componentscan and @propertysource annotations or multiple
@ComponentScans and @PropertySources container annotations. The reason
was due to lacking support in the AnnotatedTypeMetadata API.

This commit introduces support for finding all @componentscan and
@propertysource annotations by making use of the new
getMergedRepeatableAnnotationAttributes() method in
AnnotatedTypeMetadata.

Closes spring-projectsgh-30941
See spring-projectsgh-31041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant