Class SpringApplicationLauncher

java.lang.Object
org.springframework.boot.cli.app.SpringApplicationLauncher

public class SpringApplicationLauncher extends Object
A launcher for 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.
Since:
1.2.0
Author:
Andy Wilkinson
See Also:
  • Constructor Details

    • SpringApplicationLauncher

      public SpringApplicationLauncher(ClassLoader classLoader)
      Creates a new launcher that will use the given classLoader to load the configured SpringApplication class.
      Parameters:
      classLoader - the ClassLoader to use
  • Method Details

    • launch

      public Object launch(Class<?>[] sources, String[] args) throws Exception
      Launches the application created using the given sources. The application is launched with the given args.
      Parameters:
      sources - the sources for the application
      args - the args for the application
      Returns:
      the application's ApplicationContext
      Throws:
      Exception - if the launch fails
    • getEnvironmentVariable

      protected String getEnvironmentVariable(String name)