Class GrailsApplicationLauncher


  • public class GrailsApplicationLauncher
    extends java.lang.Object
    A launcher for SpringApplication or a SpringApplication subclass. The class that is used can be configured using the System property grails.application.class.name or the GRAILS_APPLICATION_CLASS_NAME environment variable. Uses reflection to allow the launching code to exist in a separate ClassLoader from the application code.
    Since:
    2022.1.0
    See Also:
    System.getProperty(String), System.getenv(String)
    • Constructor Summary

      Constructors 
      Constructor Description
      GrailsApplicationLauncher​(java.lang.ClassLoader classLoader)
      Creates a new launcher that will use the given classLoader to load the configured SpringApplication class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrailsApplicationLauncher

        public GrailsApplicationLauncher​(java.lang.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 java.lang.Object launch​(java.lang.Class<?>[] sources,
                                       java.lang.String[] args)
                                throws java.lang.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:
        java.lang.Exception - if the launch fails
      • getEnvironmentVariable

        protected java.lang.String getEnvironmentVariable​(java.lang.String name)