For the latest stable version, please use Spring Boot 3.4.0! |
PropertiesLauncher Features
PropertiesLauncher
has a few special features that can be enabled with external properties (System properties, environment variables, manifest entries, or loader.properties
).
The following table describes these properties:
Key | Purpose |
---|---|
|
Comma-separated Classpath, such as |
|
Used to resolve relative paths in |
|
Default arguments for the main method (space separated). |
|
Name of main class to launch (for example, |
|
Name of properties file (for example, |
|
Path to properties file (for example, |
|
Boolean flag to indicate that all properties should be added to System properties.
It defaults to |
When specified as environment variables or manifest entries, the following names should be used:
Key | Manifest entry | Environment variable |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Build plugins automatically move the Main-Class attribute to Start-Class when the uber jar is built.
If you use that, specify the name of the class to launch by using the Main-Class attribute and leaving out Start-Class .
|
The following rules apply to working with PropertiesLauncher
:
-
loader.properties
is searched for inloader.home
, then in the root of the classpath, and then inclasspath:/BOOT-INF/classes
. The first location where a file with that name exists is used. -
loader.home
is the directory location of an additional properties file (overriding the default) only whenloader.config.location
is not specified. -
loader.path
can contain directories (which are scanned recursively for jar and zip files), archive paths, a directory within an archive that is scanned for jar files (for example,dependencies.jar!/lib
), or wildcard patterns (for the default JVM behavior). Archive paths can be relative toloader.home
or anywhere in the file system with ajar:file:
prefix. -
loader.path
(if empty) defaults toBOOT-INF/lib
(meaning a local directory or a nested one if running from an archive). Because of this,PropertiesLauncher
behaves the same asJarLauncher
when no additional configuration is provided. -
loader.path
can not be used to configure the location ofloader.properties
(the classpath used to search for the latter is the JVM classpath whenPropertiesLauncher
is launched). -
Placeholder replacement is done from System and environment variables plus the properties file itself on all values before use.
-
The search order for properties (where it makes sense to look in more than one place) is environment variables, system properties,
loader.properties
, the exploded archive manifest, and the archive manifest.