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 AOT registration of Spring Factories #27955

Closed
bclozel opened this issue Jan 19, 2022 · 0 comments
Closed

Support AOT registration of Spring Factories #27955

bclozel opened this issue Jan 19, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jan 19, 2022

As seen in #27753, SpringFactoriesLoader is currently supported in Spring Native through subtitutions and complex AOT processors.

We'd like to improve SpringFactoriesLoader and allow static registration of Spring Factories, something our AOT processing could leverage and call early during application startup. Once a Factory type is registered with entries, SpringFactoriesLoader should use this entry as a pre-warmed cache and never look for additional entries in spring.factories files, skipping all the resource loading and reflection operations.

Instead of registering String instances as entries, this new contract might take Supplier instances instead, maybe mirroring the new contract to be added in #27954

@bclozel bclozel added in: core Issues in core modules (aop, beans, core, context, expression) status: pending-design-work Needs design work before any code can be developed theme: aot An issue related to Ahead-of-time processing labels Jan 19, 2022
@bclozel bclozel added this to the 6.0.x milestone Jan 19, 2022
@jhoeller jhoeller self-assigned this Jan 24, 2022
@jhoeller jhoeller modified the milestones: 6.0.x, 6.0.0-M3 Jan 24, 2022
@snicoll snicoll modified the milestones: 6.0.0-M3, 6.0.0-M4 Mar 16, 2022
@bclozel bclozel self-assigned this Apr 8, 2022
philwebb added a commit that referenced this issue May 11, 2022
@bclozel bclozel removed the status: pending-design-work Needs design work before any code can be developed label May 11, 2022
bclozel added a commit that referenced this issue May 11, 2022
This commit forces the resolution of all declared constructors when
registering `RuntimeHints` for Spring factories. Resolving constructors
can throw additional `NoClassDefFoundError` at runtime and during native
image compilation, if a type exposed by the constructor is missing from
the current classloader.

See gh-27955
sbrannen added a commit to sbrannen/spring-framework that referenced this issue May 11, 2022
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
Projects
None yet
Development

No branches or pull requests

3 participants