Class GrailsWebApplicationContext

java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.GenericApplicationContext
org.grails.spring.GrailsApplicationContext
grails.web.servlet.context.GrailsWebApplicationContext
All Implemented Interfaces:
groovy.lang.GroovyObject, Closeable, AutoCloseable, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.ListableBeanFactory, org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.context.ApplicationContext, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.Lifecycle, org.springframework.context.MessageSource, org.springframework.core.AliasRegistry, org.springframework.core.env.EnvironmentCapable, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver, org.springframework.ui.context.ThemeSource, org.springframework.web.context.ConfigurableWebApplicationContext, org.springframework.web.context.WebApplicationContext

public class GrailsWebApplicationContext extends org.grails.spring.GrailsApplicationContext implements org.springframework.web.context.ConfigurableWebApplicationContext, org.springframework.ui.context.ThemeSource
A WebApplicationContext that extends StaticApplicationContext to allow for programmatic configuration at runtime. The code is adapted from StaticWebApplicationContext.
Since:
0.3
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader

    org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource
  • Field Summary

    Fields inherited from class org.grails.spring.GrailsApplicationContext

    metaClass

    Fields inherited from class org.springframework.context.support.AbstractApplicationContext

    APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME

    Fields inherited from interface org.springframework.beans.factory.BeanFactory

    FACTORY_BEAN_PREFIX

    Fields inherited from interface org.springframework.context.ConfigurableApplicationContext

    APPLICATION_STARTUP_BEAN_NAME, BOOTSTRAP_EXECUTOR_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME

    Fields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext

    APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAME

    Fields inherited from interface org.springframework.core.io.ResourceLoader

    CLASSPATH_URL_PREFIX

    Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver

    CLASSPATH_ALL_URL_PREFIX

    Fields inherited from interface org.springframework.web.context.WebApplicationContext

    CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    GrailsWebApplicationContext(grails.core.GrailsApplication grailsApplication)
     
    GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory)
     
    GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, grails.core.GrailsApplication grailsApplication)
     
    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, grails.core.GrailsApplication grailsApplication)
     
    GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent)
     
    GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.core.env.ConfigurableEnvironment
     
     
     
    org.springframework.web.context.ConfigurableWebEnvironment
     
     
    protected org.springframework.core.io.Resource
    This implementation supports file paths beneath the root of the ServletContext.
    protected org.springframework.core.io.support.ResourcePatternResolver
    This implementation supports pattern matching in unexpanded WARs too.
    jakarta.servlet.ServletConfig
     
    jakarta.servlet.ServletContext
     
    protected void
    postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
    Register ServletContextAwareProcessor.
    protected void
    prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
     
    void
    setConfigLocation(String configLocation)
     
    void
    setConfigLocations(String[] configLocations)
     
    void
    setNamespace(String namespace)
     
    void
    setServletConfig(jakarta.servlet.ServletConfig servletConfig)
     
    void
    setServletContext(jakarta.servlet.ServletContext servletContext)
    Set the ServletContext that this WebApplicationContext runs in.

    Methods inherited from class org.grails.spring.GrailsApplicationContext

    assertBeanFactoryActive, containsBeanDefinition, getMetaClass, getProperty, getTheme, invokeMethod, onRefresh, registerPrototype, registerPrototype, registerSingleton, registerSingleton, setMetaClass, setProperty

    Methods inherited from class org.springframework.context.support.GenericApplicationContext

    cancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanDefinitionOverridable, isBeanNameInUse, refreshBeanFactory, refreshForAotProcessing, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setApplicationStartup, setClassLoader, setParent, setResourceLoader

    Methods inherited from class org.springframework.context.support.AbstractApplicationContext

    addApplicationListener, addBeanFactoryPostProcessor, clearResourceCaches, close, containsBean, containsLocalBean, destroyBeans, doClose, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getApplicationStartup, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isClosed, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, removeApplicationListener, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toString

    Methods inherited from class org.springframework.core.io.DefaultResourceLoader

    addProtocolResolver, getProtocolResolvers, getResourceCache

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.core.AliasRegistry

    getAliases

    Methods inherited from interface org.springframework.context.ApplicationContext

    getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate

    Methods inherited from interface org.springframework.context.ApplicationEventPublisher

    publishEvent, publishEvent

    Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry

    getBeanDefinitionCount, getBeanDefinitionNames

    Methods inherited from interface org.springframework.beans.factory.BeanFactory

    containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch

    Methods inherited from interface org.springframework.context.ConfigurableApplicationContext

    addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, isActive, isClosed, refresh, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParent

    Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory

    containsLocalBean, getParentBeanFactory

    Methods inherited from interface org.springframework.context.Lifecycle

    isRunning, start, stop

    Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory

    containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation

    Methods inherited from interface org.springframework.context.MessageSource

    getMessage, getMessage, getMessage

    Methods inherited from interface org.springframework.core.io.ResourceLoader

    getResource

    Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver

    getResources

    Methods inherited from interface org.springframework.ui.context.ThemeSource

    getTheme
  • Constructor Details

    • GrailsWebApplicationContext

      public GrailsWebApplicationContext() throws org.springframework.beans.BeansException
      Throws:
      org.springframework.beans.BeansException
    • GrailsWebApplicationContext

      public GrailsWebApplicationContext(grails.core.GrailsApplication grailsApplication)
    • GrailsWebApplicationContext

      public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent) throws org.springframework.beans.BeansException
      Throws:
      org.springframework.beans.BeansException
    • GrailsWebApplicationContext

      public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, grails.core.GrailsApplication grailsApplication)
    • GrailsWebApplicationContext

      public GrailsWebApplicationContext(org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication) throws org.springframework.beans.BeansException
      Throws:
      org.springframework.beans.BeansException
    • GrailsWebApplicationContext

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

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

      public GrailsWebApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory defaultListableBeanFactory, org.springframework.context.ApplicationContext parent, grails.core.GrailsApplication grailsApplication)
  • Method Details

    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface org.springframework.core.io.ResourceLoader
      Overrides:
      getClassLoader in class org.springframework.context.support.GenericApplicationContext
    • setServletContext

      public void setServletContext(jakarta.servlet.ServletContext servletContext)
      Set the ServletContext that this WebApplicationContext runs in.
      Specified by:
      setServletContext in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • getServletContext

      public jakarta.servlet.ServletContext getServletContext()
      Specified by:
      getServletContext in interface org.springframework.web.context.WebApplicationContext
    • setNamespace

      public void setNamespace(String namespace)
      Specified by:
      setNamespace in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • getNamespace

      public String getNamespace()
      Specified by:
      getNamespace in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • setConfigLocation

      public void setConfigLocation(String configLocation)
      Specified by:
      setConfigLocation in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • setConfigLocations

      public void setConfigLocations(String[] configLocations)
      Specified by:
      setConfigLocations in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • getConfigLocations

      public String[] getConfigLocations()
      Specified by:
      getConfigLocations in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • postProcessBeanFactory

      protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Register ServletContextAwareProcessor.
      Overrides:
      postProcessBeanFactory in class org.springframework.context.support.AbstractApplicationContext
      See Also:
      • ServletContextAwareProcessor
    • getResourceByPath

      protected org.springframework.core.io.Resource getResourceByPath(String path)
      This implementation supports file paths beneath the root of the ServletContext.
      Overrides:
      getResourceByPath in class org.springframework.core.io.DefaultResourceLoader
      See Also:
      • ServletContextResource
    • getResourcePatternResolver

      protected org.springframework.core.io.support.ResourcePatternResolver getResourcePatternResolver()
      This implementation supports pattern matching in unexpanded WARs too.
      Overrides:
      getResourcePatternResolver in class org.springframework.context.support.AbstractApplicationContext
      See Also:
      • ServletContextResourcePatternResolver
    • prepareBeanFactory

      protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Overrides:
      prepareBeanFactory in class org.grails.spring.GrailsApplicationContext
    • setServletConfig

      public void setServletConfig(jakarta.servlet.ServletConfig servletConfig)
      Specified by:
      setServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • getServletConfig

      public jakarta.servlet.ServletConfig getServletConfig()
      Specified by:
      getServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext
    • createEnvironment

      protected org.springframework.core.env.ConfigurableEnvironment createEnvironment()
      Overrides:
      createEnvironment in class org.springframework.context.support.AbstractApplicationContext
    • getEnvironment

      public org.springframework.web.context.ConfigurableWebEnvironment getEnvironment()
      Specified by:
      getEnvironment in interface org.springframework.context.ConfigurableApplicationContext
      Specified by:
      getEnvironment in interface org.springframework.core.env.EnvironmentCapable
      Overrides:
      getEnvironment in class org.springframework.context.support.AbstractApplicationContext