Package org.springframework.boot.cli.app
Class SpringApplicationLauncher
- java.lang.Object
- org.springframework.boot.cli.app.SpringApplicationLauncher
public class SpringApplicationLauncher extends Object
A launcher forSpringApplicationor aSpringApplicationsubclass. The class that is used can be configured using the System propertyspring.application.class.nameor theSPRING_APPLICATION_CLASS_NAMEenvironment variable. Uses reflection to allow the launching code to exist in a separate ClassLoader from the application code.- Since:
- 1.2.0
- See Also:
System.getProperty(String),System.getenv(String)
Constructor Summary
Constructors Constructor Description SpringApplicationLauncher(ClassLoader classLoader)Creates a new launcher that will use the givenclassLoaderto load the configuredSpringApplicationclass.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetEnvironmentVariable(String name)Objectlaunch(Class<?>[] sources, String[] args)Launches the application created using the givensources.
Constructor Detail
SpringApplicationLauncher
public SpringApplicationLauncher(ClassLoader classLoader)
Creates a new launcher that will use the givenclassLoaderto load the configuredSpringApplicationclass.- Parameters:
classLoader- theClassLoaderto use
Method Detail
launch
public Object launch(Class<?>[] sources, String[] args) throws Exception
Launches the application created using the givensources. The application is launched with the givenargs.- Parameters:
sources- the sources for the applicationargs- the args for the application- Returns:
- the application's
ApplicationContext - Throws:
Exception- if the launch fails
getEnvironmentVariable
protected String getEnvironmentVariable(String name)