public class SpringApplicationLauncher
extends java.lang.Object
SpringApplication
or a SpringApplication
subclass. The
class that is used can be configured using the System property
spring.application.class.name
or the SPRING_APPLICATION_CLASS_NAME
environment variable. Uses reflection to allow the launching code to exist in a
separate ClassLoader from the application code.System.getProperty(String)
,
System.getenv(String)
Constructor and Description |
---|
SpringApplicationLauncher(java.lang.ClassLoader classLoader)
Creates a new launcher that will use the given
classLoader to load the
configured SpringApplication class. |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getEnvironmentVariable(java.lang.String name) |
java.lang.Object |
launch(java.lang.Class<?>[] sources,
java.lang.String[] args)
Launches the application created using the given
sources . |
public SpringApplicationLauncher(java.lang.ClassLoader classLoader)
classLoader
to load the
configured SpringApplication
class.classLoader
- the ClassLoader
to usepublic java.lang.Object launch(java.lang.Class<?>[] sources, java.lang.String[] args) throws java.lang.Exception
sources
. The application
is launched with the given args
.sources
- the sources for the applicationargs
- the args for the applicationApplicationContext
java.lang.Exception
- if the launch failsprotected java.lang.String getEnvironmentVariable(java.lang.String name)