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

Multiple @ImportRuntimeHints in the type hierarchy should be supported #29361

Closed
sdeleuze opened this issue Oct 20, 2022 · 0 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@sdeleuze
Copy link
Contributor

RuntimeHintsBeanFactoryInitializationAotProcessor#extractFromBeanFactory should be able to retrieve multiple annotations in the type hierarchy not just the first one as currently with the usage of beanFactory.findAnnotationOnBean(beanName, ImportRuntimeHints.class). We should be able to get the desired behavior using MergedAnnotations.from(beanType, SearchStrategy.TYPE_HIERARCHY).stream().

This issue impacts WebFluxEndpointHandlerMapping, WebMvcEndpointHandlerMapping, CloudFoundryWebEndpointServletHandlerMapping and CloudFoundryWebFluxEndpointHandlerMapping in Spring Boot, and maybe other use cases not yet identified.

@sdeleuze sdeleuze added type: bug A general bug theme: aot An issue related to Ahead-of-time processing labels Oct 20, 2022
@sdeleuze sdeleuze added this to the 6.0.0-RC3 milestone Oct 20, 2022
@sdeleuze sdeleuze self-assigned this Oct 20, 2022
@sdeleuze sdeleuze added the in: core Issues in core modules (aop, beans, core, context, expression) label Oct 20, 2022
philwebb pushed a commit to spring-projects/spring-boot that referenced this issue Oct 21, 2022
Provide a workaround for spring-projects/spring-framework#29361 so
that multiple `@ImportRuntimeHints` can be used in a type hierarchy.

The commit should cover Actuator web endpoint use cases with the
exception of Cloud Foundry endpoints which are not possible due to
package access issues.

See gh-29361
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Oct 24, 2022
This commit copies and adapts the logic from
DefaultListableBeanFactory#findMergedAnnotationOnBean
private method to make it suitable for returning multiple
annotations found in the type hierarchy in order
to support this use case with @ImportRuntimeHints.

Closes spring-projectsgh-29361
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) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant