Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Handle Spring Boot layertools #708

Closed
snicoll opened this issue Apr 7, 2021 · 2 comments
Closed

Handle Spring Boot layertools #708

snicoll opened this issue Apr 7, 2021 · 2 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@snicoll
Copy link
Contributor

snicoll commented Apr 7, 2021

When an app is repackaged, Spring Boot adds a layertools that has some entries in spring.factories. The AOT plugin doesn't see those because they're not defined in the classpath anywhere.

Until the AOT plugin is moved to core, we'll probably have to add some special handling for this, see spring-projects/spring-boot#25711

@snicoll
Copy link
Contributor Author

snicoll commented Apr 29, 2021

The problem with the special handling is that org.springframework.boot.jarmode.layertools.LayerToolsJarMode has to be resolved by the TypeSystem before writing the entry in spring factories. This makes sense as we don't want to write some code that refers to a class that is not actually available on the classpath.

Looking at our current approach, writing that for tests won't work as the factories won't compile. Writing it only for the runtime one is hard because:

  • I don't know how we would determine we're not running in a test to add the entry
  • The factories wouldn't compile anyway when running such an app outside of a repackaged archive (i.e. in an IDE or via spring-boot:run.

@bclozel
Copy link
Contributor

bclozel commented May 18, 2021

This has been fixed with cc87cf5

Because we're not using the AOT generated classes anymore by default, the regular code path (looking up spring.factories on the classpath) is used and the layertools are detected properly.

@bclozel bclozel closed this as completed May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Development

No branches or pull requests

2 participants