Package: grails.web.servlet.context

## [Java] Class GrailsWebApplicationContext

- grails.web.servlet.context.GrailsWebApplicationContext

- All Implemented Interfaces and Traits:
    org.springframework.web.context.ConfigurableWebApplicationContext, org.springframework.ui.context.ThemeSource

      public class GrailsWebApplicationContext
      extends GrailsApplicationContext

  A WebApplicationContext that extends StaticApplicationContext to allow for programmatic configuration at runtime. The code is adapted from StaticWebApplicationContext.

  Authors:
    Graeme
  Since:
    0.3

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class GrailsApplicationContext` | `metaClass`
    `class org.springframework.context.support.GenericApplicationContext` | `MESSAGE_SOURCE_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, APPLICATION_EVENT_MULTICASTER_BEAN_NAME, CLASSPATH_URL_PREFIX`

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `java.lang.String[]` | `configLocations`
    `java.lang.String` | `namespace`
    `javax.servlet.ServletConfig` | `servletConfig`
    `javax.servlet.ServletContext` | `servletContext`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GrailsWebApplicationContext ()`
    `GrailsWebApplicationContext (GrailsApplication grailsApplication)`
    `GrailsWebApplicationContext (org.springframework.context.ApplicationContext parent)`
    `GrailsWebApplicationContext (org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, GrailsApplication grailsApplication)`
    `GrailsWebApplicationContext (org.springframework.context.ApplicationContext parent, GrailsApplication grailsApplication)`
    `GrailsWebApplicationContext (org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory)`
    `GrailsWebApplicationContext (org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent)`
    `GrailsWebApplicationContext (org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent, GrailsApplication grailsApplication)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected org.springframework.core.env.ConfigurableEnvironment` | `createEnvironment()`
    `` | `java.lang.ClassLoader` | `getClassLoader()`
    `` | `java.lang.String[]` | `getConfigLocations()`
    `` | `org.springframework.web.context.ConfigurableWebEnvironment` | `getEnvironment()`
    `` | `java.lang.String` | `getNamespace()`
    `` | `protected org.springframework.core.io.Resource` | `getResourceByPath(java.lang.String path)` This implementation supports file paths beneath the root of the ServletContext.
    `` | `protected org.springframework.core.io.support.ResourcePatternResolver` | `getResourcePatternResolver()` This implementation supports pattern matching in unexpanded WARs too.
    `` | `javax.servlet.ServletConfig` | `getServletConfig()`
    `` | `javax.servlet.ServletContext` | `getServletContext()`
    `` | `protected void` | `postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)` Register ServletContextAwareProcessor.
    `` | `protected void` | `prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)`
    `` | `void` | `setConfigLocation(java.lang.String configLocation)`
    `` | `void` | `setConfigLocations(java.lang.String[] configLocations)`
    `` | `void` | `setNamespace(java.lang.String namespace)`
    `` | `void` | `setServletConfig(javax.servlet.ServletConfig servletConfig)`
    `` | `void` | `setServletContext(javax.servlet.ServletContext servletContext)` Set the ServletContext that this WebApplicationContext runs in.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GrailsApplicationContext` | `assertBeanFactoryActive, containsBeanDefinition, getMetaClass, getProperty, getTheme, invokeMethod, onRefresh, prepareBeanFactory, registerPrototype, registerPrototype, registerSingleton, registerSingleton, setMetaClass, setProperty`
    `class org.springframework.context.support.GenericApplicationContext` | `org.springframework.context.support.GenericApplicationContext#getBeanFactory(), org.springframework.context.support.GenericApplicationContext#isAlias(java.lang.String), org.springframework.context.support.GenericApplicationContext#isBeanNameInUse(java.lang.String), org.springframework.context.support.GenericApplicationContext#setAllowCircularReferences(boolean), org.springframework.context.support.GenericApplicationContext#setResourceLoader(org.springframework.core.io.ResourceLoader), org.springframework.context.support.GenericApplicationContext#setClassLoader(java.lang.ClassLoader), org.springframework.context.support.GenericApplicationContext#setAllowBeanDefinitionOverriding(boolean), org.springframework.context.support.GenericApplicationContext#getAutowireCapableBeanFactory(), org.springframework.context.support.GenericApplicationContext#registerAlias(java.lang.String, java.lang.String), org.springframework.context.support.GenericApplicationContext#removeAlias(java.lang.String), org.springframework.context.support.GenericApplicationContext#getBeanDefinition(java.lang.String), org.springframework.context.support.GenericApplicationContext#registerBeanDefinition(java.lang.String, org.springframework.beans.factory.config.BeanDefinition), org.springframework.context.support.GenericApplicationContext#removeBeanDefinition(java.lang.String), org.springframework.context.support.GenericApplicationContext#getDefaultListableBeanFactory(), org.springframework.context.support.GenericApplicationContext#registerBean(java.lang.Class, [Lorg.springframework.beans.factory.config.BeanDefinitionCustomizer;), org.springframework.context.support.GenericApplicationContext#registerBean(java.lang.Class, java.util.function.Supplier, [Lorg.springframework.beans.factory.config.BeanDefinitionCustomizer;), org.springframework.context.support.GenericApplicationContext#registerBean(java.lang.String, java.lang.Class, [Lorg.springframework.beans.factory.config.BeanDefinitionCustomizer;), org.springframework.context.support.GenericApplicationContext#registerBean(java.lang.String, java.lang.Class, java.util.function.Supplier, [Lorg.springframework.beans.factory.config.BeanDefinitionCustomizer;), org.springframework.context.support.GenericApplicationContext#getClassLoader(), org.springframework.context.support.GenericApplicationContext#getResource(java.lang.String), org.springframework.context.support.GenericApplicationContext#getResources(java.lang.String), org.springframework.context.support.GenericApplicationContext#setParent(org.springframework.context.ApplicationContext), org.springframework.context.support.GenericApplicationContext#setDisplayName(java.lang.String), org.springframework.context.support.GenericApplicationContext#isRunning(), org.springframework.context.support.GenericApplicationContext#isActive(), org.springframework.context.support.GenericApplicationContext#containsBean(java.lang.String), org.springframework.context.support.GenericApplicationContext#addBeanFactoryPostProcessor(org.springframework.beans.factory.config.BeanFactoryPostProcessor), org.springframework.context.support.GenericApplicationContext#addApplicationListener(org.springframework.context.ApplicationListener), org.springframework.context.support.GenericApplicationContext#isSingleton(java.lang.String), org.springframework.context.support.GenericApplicationContext#setEnvironment(org.springframework.core.env.ConfigurableEnvironment), org.springframework.context.support.GenericApplicationContext#getBean(java.lang.Class), org.springframework.context.support.GenericApplicationContext#getBean(java.lang.Class, [Ljava.lang.Object;), org.springframework.context.support.GenericApplicationContext#getBean(java.lang.String, java.lang.Class), org.springframework.context.support.GenericApplicationContext#getBean(java.lang.String), org.springframework.context.support.GenericApplicationContext#getBean(java.lang.String, [Ljava.lang.Object;), org.springframework.context.support.GenericApplicationContext#getBeanProvider(org.springframework.core.ResolvableType), org.springframework.context.support.GenericApplicationContext#getBeanProvider(java.lang.Class), org.springframework.context.support.GenericApplicationContext#getStartupDate(), org.springframework.context.support.GenericApplicationContext#getApplicationName(), org.springframework.context.support.GenericApplicationContext#isPrototype(java.lang.String), org.springframework.context.support.GenericApplicationContext#isTypeMatch(java.lang.String, java.lang.Class), org.springframework.context.support.GenericApplicationContext#isTypeMatch(java.lang.String, org.springframework.core.ResolvableType), org.springframework.context.support.GenericApplicationContext#getAliases(java.lang.String), org.springframework.context.support.GenericApplicationContext#getEnvironment(), org.springframework.context.support.GenericApplicationContext#getEnvironment(), org.springframework.context.support.GenericApplicationContext#getBeansOfType(java.lang.Class, boolean, boolean), org.springframework.context.support.GenericApplicationContext#getBeansOfType(java.lang.Class), org.springframework.context.support.GenericApplicationContext#containsBeanDefinition(java.lang.String), org.springframework.context.support.GenericApplicationContext#getParentBeanFactory(), org.springframework.context.support.GenericApplicationContext#containsLocalBean(java.lang.String), org.springframework.context.support.GenericApplicationContext#publishEvent(java.lang.Object), org.springframework.context.support.GenericApplicationContext#publishEvent(org.springframework.context.ApplicationEvent), org.springframework.context.support.GenericApplicationContext#getBeanDefinitionCount(), org.springframework.context.support.GenericApplicationContext#getBeanDefinitionNames(), org.springframework.context.support.GenericApplicationContext#getBeanNamesForType(java.lang.Class), org.springframework.context.support.GenericApplicationContext#getBeanNamesForType(org.springframework.core.ResolvableType), org.springframework.context.support.GenericApplicationContext#getBeanNamesForType(java.lang.Class, boolean, boolean), org.springframework.context.support.GenericApplicationContext#getBeanNamesForAnnotation(java.lang.Class), org.springframework.context.support.GenericApplicationContext#getBeansWithAnnotation(java.lang.Class), org.springframework.context.support.GenericApplicationContext#findAnnotationOnBean(java.lang.String, java.lang.Class), org.springframework.context.support.GenericApplicationContext#setId(java.lang.String), org.springframework.context.support.GenericApplicationContext#refresh(), org.springframework.context.support.GenericApplicationContext#getBeanFactoryPostProcessors(), org.springframework.context.support.GenericApplicationContext#getApplicationListeners(), org.springframework.context.support.GenericApplicationContext#toString(), org.springframework.context.support.GenericApplicationContext#getParent(), org.springframework.context.support.GenericApplicationContext#getMessage(java.lang.String, [Ljava.lang.Object;, java.lang.String, java.util.Locale), org.springframework.context.support.GenericApplicationContext#getMessage(org.springframework.context.MessageSourceResolvable, java.util.Locale), org.springframework.context.support.GenericApplicationContext#getMessage(java.lang.String, [Ljava.lang.Object;, java.util.Locale), org.springframework.context.support.GenericApplicationContext#start(), org.springframework.context.support.GenericApplicationContext#stop(), org.springframework.context.support.GenericApplicationContext#destroy(), org.springframework.context.support.GenericApplicationContext#getId(), org.springframework.context.support.GenericApplicationContext#close(), org.springframework.context.support.GenericApplicationContext#getType(java.lang.String), org.springframework.context.support.GenericApplicationContext#registerShutdownHook(), org.springframework.context.support.GenericApplicationContext#getDisplayName(), org.springframework.context.support.GenericApplicationContext#addProtocolResolver(org.springframework.core.io.ProtocolResolver), org.springframework.context.support.GenericApplicationContext#clearResourceCaches(), org.springframework.context.support.GenericApplicationContext#getResourceCache(java.lang.Class), org.springframework.context.support.GenericApplicationContext#getProtocolResolvers(), org.springframework.context.support.GenericApplicationContext#wait(long, int), org.springframework.context.support.GenericApplicationContext#wait(long), org.springframework.context.support.GenericApplicationContext#wait(), org.springframework.context.support.GenericApplicationContext#equals(java.lang.Object), org.springframework.context.support.GenericApplicationContext#hashCode(), org.springframework.context.support.GenericApplicationContext#getClass(), org.springframework.context.support.GenericApplicationContext#notify(), org.springframework.context.support.GenericApplicationContext#notifyAll()`

- - ### Property Detail

    - #### java.lang.String[] configLocations

    - #### java.lang.String namespace

    - #### javax.servlet.ServletConfig servletConfig

    - #### javax.servlet.ServletContext servletContext

  - ### Constructor Detail

    - #### public GrailsWebApplicationContext()

    - #### public GrailsWebApplicationContext(GrailsApplication grailsApplication)

    - #### public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent)

    - #### public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, GrailsApplication grailsApplication)

    - #### public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent, GrailsApplication grailsApplication)

    - #### public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory)

    - #### public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent)

    - #### public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent, GrailsApplication grailsApplication)

  - ### Method Detail

    - #### @java.lang.Override protected org.springframework.core.env.ConfigurableEnvironment createEnvironment()

    - #### @java.lang.Override public java.lang.ClassLoader getClassLoader()

    - #### public java.lang.String[] getConfigLocations()

    - #### @java.lang.Override public org.springframework.web.context.ConfigurableWebEnvironment getEnvironment()

    - #### public java.lang.String getNamespace()

    - #### @java.lang.Override protected org.springframework.core.io.Resource getResourceByPath(java.lang.String path)

      This implementation supports file paths beneath the root of the ServletContext.

      See Also:
        org.springframework.web.context.support.ServletContextResource

    - #### @java.lang.Override protected org.springframework.core.io.support.ResourcePatternResolver getResourcePatternResolver()

      This implementation supports pattern matching in unexpanded WARs too.

      See Also:
        org.springframework.web.context.support.ServletContextResourcePatternResolver

    - #### public javax.servlet.ServletConfig getServletConfig()

    - #### public javax.servlet.ServletContext getServletContext()

    - #### @java.lang.Override protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

      Register ServletContextAwareProcessor.

      See Also:
        org.springframework.web.context.support.ServletContextAwareProcessor

    - #### @java.lang.Override protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

    - #### public void setConfigLocation(java.lang.String configLocation)

    - #### public void setConfigLocations(java.lang.String[] configLocations)

    - #### public void setNamespace(java.lang.String namespace)

    - #### public void setServletConfig(javax.servlet.ServletConfig servletConfig)

    - #### public void setServletContext(javax.servlet.ServletContext servletContext)

      Set the ServletContext that this WebApplicationContext runs in.