Download spring-boot-referenc..
Transcript
Spring Boot Reference Guide
opposed to explicitly on the classpath). In the case of the [Jar|War]Launcher the nested paths
are fixed (lib/*.jar and lib-provided/*.jar for the war case) so you just add extra jars in
those locations if you want more. The PropertiesLauncher looks in lib/ in your application archive
by default, but you can add additional locations by setting an environment variable LOADER_PATH or
loader.path in application.properties (comma-separated list of directories or archives).
Launcher manifest
You need to specify an appropriate Launcher as the Main-Class attribute of META-INF/
MANIFEST.MF. The actual class that you want to launch (i.e. the class that you wrote that contains a
main method) should be specified in the Start-Class attribute.
For example, here is a typical MANIFEST.MF for an executable jar file:
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.mycompany.project.MyApplication
For a war file, it would be:
Main-Class: org.springframework.boot.loader.WarLauncher
Start-Class: com.mycompany.project.MyApplication
Note
You do not need to specify Class-Path entries in your manifest file, the classpath will be deduced
from the nested jars.
Exploded archives
Certain PaaS implementations may choose to unpack archives before they run. For example, Cloud
Foundry operates in this way. You can run an unpacked archive by simply starting the appropriate
launcher:
$ unzip -q myapp.jar
$ java org.springframework.boot.loader.JarLauncher
D.4 PropertiesLauncher Features
PropertiesLauncher has a few special features that can be enabled with external properties (System
properties, environment variables, manifest entries or application.properties).
Key
Purpose
loader.path
Comma-separated Classpath, e.g. lib,${HOME}/app/lib.
Earlier entries take precedence, just like a regular -classpath
on the javac command line.
loader.home
Location of additional properties file, e.g. /opt/app (defaults to
${user.dir})
loader.args
Default arguments for the main method (space separated)
loader.main
Name of main class to launch, e.g. com.app.Application.
1.3.1.BUILD-SNAPSHOT
Spring Boot
269