Package grails.boot

Class Grails


  • public class Grails
    extends org.springframework.boot.SpringApplication
    Extends the SpringApplication with reloading behavior and other Grails features
    Since:
    3.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.springframework.core.env.ConfigurableEnvironment configuredEnvironment  
      • Fields inherited from class org.springframework.boot.SpringApplication

        BANNER_LOCATION_PROPERTY, BANNER_LOCATION_PROPERTY_VALUE
    • Constructor Summary

      Constructors 
      Constructor Description
      Grails​(java.lang.Class<?>... sources)
      Create a new Grails instance.
      Grails​(org.springframework.core.io.ResourceLoader resourceLoader, java.lang.Class<?>... sources)
      Create a new Grails instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void compileGroovyFile​(org.codehaus.groovy.control.CompilerConfiguration compilerConfig, java.io.File changedFile)  
      protected void configureBanner​(grails.util.Environment environment)  
      protected void configureDirectoryWatcher​(org.grails.io.watch.DirectoryWatcher directoryWatcher, java.lang.String location)  
      protected void configureEnvironment​(org.springframework.core.env.ConfigurableEnvironment environment, java.lang.String[] args)  
      protected org.springframework.context.ConfigurableApplicationContext createApplicationContext()  
      protected static org.grails.io.watch.DirectoryWatcher.FileChangeListener createPluginManagerListener​(org.springframework.context.ConfigurableApplicationContext applicationContext)
      Creates and returns a file change listener for notifying the plugin manager of changes.
      protected void enableDevelopmentModeWatch​(grails.util.Environment environment, org.springframework.context.ConfigurableApplicationContext applicationContext, java.lang.String... args)  
      static boolean isDevelopmentModeActive()  
      static void main​(java.lang.String[] args)  
      protected void printRunStatus​(org.springframework.context.ConfigurableApplicationContext applicationContext)  
      protected void recompile​(java.io.File changedFile, org.codehaus.groovy.control.CompilerConfiguration compilerConfig, java.lang.String location)  
      static org.springframework.context.ConfigurableApplicationContext run​(java.lang.Class<?>[] sources, java.lang.String[] args)
      Static helper that can be used to run a Grails from the specified sources using default settings and user supplied arguments.
      static org.springframework.context.ConfigurableApplicationContext run​(java.lang.Class<?> source, java.lang.String... args)
      Static helper that can be used to run a Grails from the specified source using default settings.
      org.springframework.context.ConfigurableApplicationContext run​(java.lang.String... args)  
      static void setDevelopmentModeActive​(boolean active)  
      • Methods inherited from class org.springframework.boot.SpringApplication

        addBootstrapRegistryInitializer, addInitializers, addListeners, addPrimarySources, afterRefresh, applyInitializers, bindToSpringApplication, configureProfiles, configurePropertySources, createBeanDefinitionLoader, exit, getAdditionalProfiles, getAllSources, getApplicationLog, getApplicationStartup, getClassLoader, getEnvironmentPrefix, getInitializers, getListeners, getMainApplicationClass, getResourceLoader, getShutdownHandlers, getSources, getWebApplicationType, load, logStartupInfo, logStartupProfileInfo, postProcessApplicationContext, refresh, registerLoggedException, setAddCommandLineProperties, setAddConversionService, setAdditionalProfiles, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setApplicationContextFactory, setApplicationStartup, setBanner, setBannerMode, setBeanNameGenerator, setDefaultProperties, setDefaultProperties, setEnvironment, setEnvironmentPrefix, setHeadless, setInitializers, setLazyInitialization, setListeners, setLogStartupInfo, setMainApplicationClass, setRegisterShutdownHook, setResourceLoader, setSources, setWebApplicationType
      • Methods inherited from class java.lang.Object

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

      • configuredEnvironment

        protected org.springframework.core.env.ConfigurableEnvironment configuredEnvironment
    • Constructor Detail

      • Grails

        public Grails​(java.lang.Class<?>... sources)
        Create a new Grails instance. The application context will load beans from the specified sources (see class-level documentation for details. The instance can be customized before calling run(String...).
        Parameters:
        sources - the bean sources
      • Grails

        public Grails​(org.springframework.core.io.ResourceLoader resourceLoader,
                      java.lang.Class<?>... sources)
        Create a new Grails instance. The application context will load beans from the specified sources (see class-level documentation for details. The instance can be customized before calling run(String...).
        Parameters:
        resourceLoader - the resource loader to use
        sources - the bean sources
    • Method Detail

      • run

        public org.springframework.context.ConfigurableApplicationContext run​(java.lang.String... args)
        Overrides:
        run in class org.springframework.boot.SpringApplication
      • createApplicationContext

        protected org.springframework.context.ConfigurableApplicationContext createApplicationContext()
        Overrides:
        createApplicationContext in class org.springframework.boot.SpringApplication
      • configureEnvironment

        protected void configureEnvironment​(org.springframework.core.env.ConfigurableEnvironment environment,
                                            java.lang.String[] args)
        Overrides:
        configureEnvironment in class org.springframework.boot.SpringApplication
      • configureBanner

        protected void configureBanner​(grails.util.Environment environment)
      • enableDevelopmentModeWatch

        protected void enableDevelopmentModeWatch​(grails.util.Environment environment,
                                                  org.springframework.context.ConfigurableApplicationContext applicationContext,
                                                  java.lang.String... args)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • isDevelopmentModeActive

        public static boolean isDevelopmentModeActive()
      • setDevelopmentModeActive

        public static void setDevelopmentModeActive​(boolean active)
      • recompile

        protected void recompile​(java.io.File changedFile,
                                 org.codehaus.groovy.control.CompilerConfiguration compilerConfig,
                                 java.lang.String location)
      • compileGroovyFile

        protected void compileGroovyFile​(org.codehaus.groovy.control.CompilerConfiguration compilerConfig,
                                         java.io.File changedFile)
      • createPluginManagerListener

        protected static org.grails.io.watch.DirectoryWatcher.FileChangeListener createPluginManagerListener​(org.springframework.context.ConfigurableApplicationContext applicationContext)
        Creates and returns a file change listener for notifying the plugin manager of changes.
        Parameters:
        applicationContext - - The running ApplicationContext
        Returns:
        DirectoryWatcher.FileChangeListener
      • configureDirectoryWatcher

        protected void configureDirectoryWatcher​(org.grails.io.watch.DirectoryWatcher directoryWatcher,
                                                 java.lang.String location)
      • printRunStatus

        protected void printRunStatus​(org.springframework.context.ConfigurableApplicationContext applicationContext)
      • run

        public static org.springframework.context.ConfigurableApplicationContext run​(java.lang.Class<?> source,
                                                                                     java.lang.String... args)
        Static helper that can be used to run a Grails from the specified source using default settings.
        Parameters:
        source - the source to load
        args - the application arguments (usually passed from a Java main method)
        Returns:
        the running ApplicationContext
      • run

        public static org.springframework.context.ConfigurableApplicationContext run​(java.lang.Class<?>[] sources,
                                                                                     java.lang.String[] args)
        Static helper that can be used to run a Grails from the specified sources using default settings and user supplied arguments.
        Parameters:
        sources - the sources to load
        args - the application arguments (usually passed from a Java main method)
        Returns:
        the running ApplicationContext
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception