Class 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
    See Also:
    System.getProperty(String), System.getenv(String)
    • Constructor Detail

      • 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 Detail

      • 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