spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Add API to customize features of Spring AOT

Open snicoll opened this issue 2 months ago • 0 comments

Thus far, Spring AOT is this one thing that does refresh the context, invokes contributors and then dump the state of the BeanFactory in generated code. It also write additional files such as native metadata.

We want to provide more flexibility in what Spring AOT does.

This issue is about researching what this API could look like with the following customizations hookpoint:

  • Lock down the bean factory (current behavior)
  • Record classpath scanning outcome and make it available at runtime (*)
  • Create CGLIB proxies
  • Process Runtime Hints
  • Write Runtime Hints as GraalVM metadata (**)

(*) should not be done if the bean factory is locked down. Similarly, writing runtime hints can't be enabled if they aren't processed. This shows that there are features that can't be individual options and rather needs to be linked to something else.

Such feature is linked to additional processing that happens in ApplicationContextAotGenerator. It may be a new PostProcessor, but it could also be something that needs to be enabled as part of GenericApplication#refreshForAotProcessing.

snicoll avatar Sep 18 '25 11:09 snicoll