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

Improve SpringApplication to provide a streamline setup for Native image

Open snicoll opened this issue 2 years ago • 1 comments

There are a number of things in SpringApplication that are inferred at runtime based on the classpath, the environment or another property.

Some of those checks do not work properly in a native image and can lead to larger image size and build time.

This issue is about researching how we could provide a more streamline setup for that case, in no particular order:

  • Set the ApplicationContext type to use rather than figuring out which one to use based on the web application type
  • Set the main application class rather than deducing it from the call stack
  • Specify the ApplicationContextInitializers to use
  • No notion of "sources" (as the context is ready)

snicoll avatar Apr 08 '22 14:04 snicoll

I am wondering if we want to do this as described or rather optimize thing on a case-by-case basis. Flagging for team attention to see if the team feels differently.

snicoll avatar Sep 21 '22 11:09 snicoll

At this point I think doing things case-by-case is best, possibly even leaving a few things as sub-optimal until 3.1.

philwebb avatar Oct 03 '22 22:10 philwebb

Alright. Let's close this one then, no need to have it around.

snicoll avatar Oct 04 '22 07:10 snicoll