spring-projects-experimental / spring-boot-testjars

67 stars 6 forks source link

Add JarLauncherDetector main class #46

Closed Kehrlann closed 4 months ago

Kehrlann commented 5 months ago

Reflectively detect which JarLauncher to use

Closes gh-32

Open questions:

rwinch commented 5 months ago

@Kehrlann Thanks for the draft PR

We spoke about the testing and I think that mocking the static method makes sense.

As for if no JarLauncher is found, I'd add the SpringBootApplicationMain as the fallback to JarLauncherDetector.

I'd also make the default main class the new JarLauncherDetector

Kehrlann commented 5 months ago

@rwinch addressed comments.

I'm still wondering whether we should log something when the JarLauncherDetector runs and fails to find a suitable launcher, warning the user that we're falling back on the default SpringBootApplicationMain.

Since the Spring app is not running yet, slf4j is not bootstrapped, so I'm unsure what to do.

rwinch commented 4 months ago

Thanks for the Pull Request! This is now merged into main :smile:

rwinch commented 4 months ago

@Kehrlann Thank you this looks good. Let's handle the concerns you had around failures in a separate ticket.