-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
Our applications contain multiple main classes via dependent jar library.
(e.g.: a dependent jar contains simple tool app to run db upgrade.)
Currently, [Jar|War]Launcher
reads Start-Class
from manifest file and simply fails if it doesn't exist.
Since [Jar|War]Launcher
is used for fat jar, java -jar
method cannot run different main class when there are other main classes available in the jar(maybe nested jar).
Workaround is to use PropertiesLauncher
with java -cp
.
java -cp app.jar -Dloader.main=com.example.AnotherApplication org.springframework.boot.loader.PropertiesLauncher
Similar to jarmode
, it would be nice to allow [Jar|War]Launcher
to take special system property to allow overriding start-class.
e.g.:
java -jar -Dstart-class=com.example.AnotherApplication app.jar
This way, user can just use java -jar
instead of java -cp ...
with PropertiesLauncher
.
Since many users simply use java -jar
, it is convenient and discoverable option than PeropertiesLauncher
.