类 PropertiesLauncher
- java.lang.Object
- org.springframework.boot.loader.Launcher
- org.springframework.boot.loader.PropertiesLauncher
public class PropertiesLauncher extends Launcher
Launcher
for archives with user-configured classpath and main class via a properties file. This model is often more flexible and more amenable to creating well-behaved OS-level services than a model based on executable jars.Looks in various places for a properties file to extract loader settings, defaulting to
application.properties
either on the current classpath or in the current working directory. The name of the properties file can be changed by setting a System propertyloader.config.name
(e.g.-Dloader.config.name=foo
will look forfoo.properties
. If that file doesn't exist then triesloader.config.location
(with allowed prefixesclasspath:
andfile:
or any valid URL). Once that file is located turns it into Properties and extracts optional values (which can also be provided overridden as System properties in case the file doesn't exist):loader.path
: a comma-separated list of directories (containing file resources and/or nested archives in *.jar or *.zip or archives) or archives to append to the classpath.BOOT-INF/classes,BOOT-INF/lib
in the application archive are always usedloader.main
: the main method to delegate execution to once the class loader is set up. No default, but will fall back to looking for aStart-Class
in aMANIFEST.MF
, if there is one in${loader.home}/META-INF
.
字段概要
字段 修饰符和类型 字段 说明 static String
ARGS
Properties key for default command line arguments.static String
CONFIG_LOCATION
Properties key for config file location (including optional classpath:, file: or URL prefix).static String
CONFIG_NAME
Properties key for name of external configuration file (excluding suffix).static String
HOME
Properties key for home directory.static String
MAIN
Properties key for main class.static String
PATH
Properties key for classpath entries (directories possibly containing jars or jars).static String
SET_SYSTEM_PROPERTIES
Properties key for boolean flag (default false) which if set will cause the external configuration properties to be copied to System properties (assuming that is allowed by Java security).
构造器概要
构造器 构造器 说明 PropertiesLauncher()
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected ClassLoader
createClassLoader(List<Archive> archives)
Create a classloader for the specified archives.protected String[]
getArgs(String... args)
protected List<Archive>
getClassPathArchives()
Returns the archives that will be used to construct the class path.protected File
getHomeDirectory()
protected String
getMainClass()
Returns the main class that should be launched.static void
main(String[] args)
static String
toCamelCase(CharSequence string)
从类继承的方法 org.springframework.boot.loader.Launcher
createArchive, createClassLoader, createMainMethodRunner, launch, launch
字段详细资料
MAIN
public static final String MAIN
Properties key for main class. As a manifest entry can also be specified asStart-Class
.- 另请参阅:
- 常量字段值
PATH
public static final String PATH
Properties key for classpath entries (directories possibly containing jars or jars). Multiple entries can be specified using a comma-separated list.BOOT-INF/classes,BOOT-INF/lib
in the application archive are always used.- 另请参阅:
- 常量字段值
HOME
public static final String HOME
Properties key for home directory. This is the location of external configuration if not on classpath, and also the base path for any relative paths in theloader path
. Defaults to current working directory (${user.dir}
).- 另请参阅:
- 常量字段值
ARGS
public static final String ARGS
Properties key for default command line arguments. These arguments (if present) are prepended to the main method arguments before launching.- 另请参阅:
- 常量字段值
CONFIG_NAME
public static final String CONFIG_NAME
Properties key for name of external configuration file (excluding suffix). Defaults to "application". Ignored ifloader config location
is provided instead.- 另请参阅:
- 常量字段值
CONFIG_LOCATION
public static final String CONFIG_LOCATION
Properties key for config file location (including optional classpath:, file: or URL prefix).- 另请参阅:
- 常量字段值
SET_SYSTEM_PROPERTIES
public static final String SET_SYSTEM_PROPERTIES
Properties key for boolean flag (default false) which if set will cause the external configuration properties to be copied to System properties (assuming that is allowed by Java security).- 另请参阅:
- 常量字段值
构造器详细资料
PropertiesLauncher
public PropertiesLauncher()
方法详细资料
getHomeDirectory
protected File getHomeDirectory()
getMainClass
protected String getMainClass() throws Exception
从类复制的说明:Launcher
Returns the main class that should be launched.- 指定者:
getMainClass
在类中Launcher
- 返回:
- the name of the main class
- 抛出:
Exception
- if the main class cannot be obtained
createClassLoader
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception
从类复制的说明:Launcher
Create a classloader for the specified archives.- 覆盖:
createClassLoader
在类中Launcher
- 参数:
archives
- the archives- 返回:
- the classloader
- 抛出:
Exception
- if the classloader cannot be created
getClassPathArchives
protected List<Archive> getClassPathArchives() throws Exception
从类复制的说明:Launcher
Returns the archives that will be used to construct the class path.- 指定者:
getClassPathArchives
在类中Launcher
- 返回:
- the class path archives
- 抛出:
Exception
- if the class path archives cannot be obtained
toCamelCase
public static String toCamelCase(CharSequence string)