This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.3.4!spring-doc.cn

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:spring-doc.cn

Key Purpose

loader.pathspring-doc.cn

Comma-separated Classpath, such as lib,${HOME}/app/lib. Earlier entries take precedence, like a regular -classpath on the javac command line.spring-doc.cn

loader.homespring-doc.cn

Used to resolve relative paths in loader.path. For example, given loader.path=lib, then ${loader.home}/lib is a classpath location (along with all jar files in that directory). This property is also used to locate a loader.properties file, as in the following example /opt/app It defaults to ${user.dir}.spring-doc.cn

loader.argsspring-doc.cn

Default arguments for the main method (space separated).spring-doc.cn

loader.mainspring-doc.cn

Name of main class to launch (for example, com.app.Application).spring-doc.cn

loader.config.namespring-doc.cn

Name of properties file (for example, launcher). It defaults to loader.spring-doc.cn

loader.config.locationspring-doc.cn

Path to properties file (for example, classpath:loader.properties). It defaults to loader.properties.spring-doc.cn

loader.systemspring-doc.cn

Boolean flag to indicate that all properties should be added to System properties. It defaults to false.spring-doc.cn

When specified as environment variables or manifest entries, the following names should be used:spring-doc.cn

Key Manifest entry Environment variable

loader.pathspring-doc.cn

Loader-Pathspring-doc.cn

LOADER_PATHspring-doc.cn

loader.homespring-doc.cn

Loader-Homespring-doc.cn

LOADER_HOMEspring-doc.cn

loader.argsspring-doc.cn

Loader-Argsspring-doc.cn

LOADER_ARGSspring-doc.cn

loader.mainspring-doc.cn

Start-Classspring-doc.cn

LOADER_MAINspring-doc.cn

loader.config.locationspring-doc.cn

Loader-Config-Locationspring-doc.cn

LOADER_CONFIG_LOCATIONspring-doc.cn

loader.systemspring-doc.cn

Loader-Systemspring-doc.cn

LOADER_SYSTEMspring-doc.cn

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.
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:spring-doc.cn

  • loader.properties is searched for in loader.home, then in the root of the classpath, and then in classpath:/BOOT-INF/classes. The first location where a file with that name exists is used.spring-doc.cn

  • loader.home is the directory location of an additional properties file (overriding the default) only when loader.config.location is not specified.spring-doc.cn

  • 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 to loader.home or anywhere in the file system with a jar:file: prefix.spring-doc.cn

  • loader.path (if empty) defaults to BOOT-INF/lib (meaning a local directory or a nested one if running from an archive). Because of this, PropertiesLauncher behaves the same as JarLauncher when no additional configuration is provided.spring-doc.cn

  • loader.path can not be used to configure the location of loader.properties (the classpath used to search for the latter is the JVM classpath when PropertiesLauncher is launched).spring-doc.cn

  • Placeholder replacement is done from System and environment variables plus the properties file itself on all values before use.spring-doc.cn

  • 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.spring-doc.cn