Package grails.web.servlet.context
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
metaClassFields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAMEFields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIXFields 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_NAMEFields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAMEFields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIXFields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIXFields 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
ConstructorsConstructorDescriptionGrailsWebApplicationContext(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 TypeMethodDescriptionprotected org.springframework.core.env.ConfigurableEnvironmentString[]org.springframework.web.context.ConfigurableWebEnvironmentprotected org.springframework.core.io.ResourcegetResourceByPath(String path) This implementation supports file paths beneath the root of the ServletContext.protected org.springframework.core.io.support.ResourcePatternResolverThis implementation supports pattern matching in unexpanded WARs too.jakarta.servlet.ServletConfigjakarta.servlet.ServletContextprotected voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Register ServletContextAwareProcessor.protected voidprepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) voidsetConfigLocation(String configLocation) voidsetConfigLocations(String[] configLocations) voidsetNamespace(String namespace) voidsetServletConfig(jakarta.servlet.ServletConfig servletConfig) voidsetServletContext(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, setPropertyMethods 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, setResourceLoaderMethods 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, toStringMethods inherited from class org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, getProtocolResolvers, getResourceCacheMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.AliasRegistry
getAliasesMethods inherited from interface org.springframework.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDateMethods inherited from interface org.springframework.context.ApplicationEventPublisher
publishEvent, publishEventMethods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry
getBeanDefinitionCount, getBeanDefinitionNamesMethods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchMethods inherited from interface org.springframework.context.ConfigurableApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, isActive, isClosed, refresh, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParentMethods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactoryMethods inherited from interface org.springframework.context.Lifecycle
isRunning, start, stopMethods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotationMethods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessageMethods inherited from interface org.springframework.core.io.ResourceLoader
getResourceMethods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResourcesMethods 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
- Specified by:
getClassLoaderin interfaceorg.springframework.core.io.ResourceLoader- Overrides:
getClassLoaderin classorg.springframework.context.support.GenericApplicationContext
-
setServletContext
public void setServletContext(jakarta.servlet.ServletContext servletContext) Set the ServletContext that this WebApplicationContext runs in.- Specified by:
setServletContextin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Specified by:
getServletContextin interfaceorg.springframework.web.context.WebApplicationContext
-
setNamespace
- Specified by:
setNamespacein interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getNamespace
- Specified by:
getNamespacein interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
setConfigLocation
- Specified by:
setConfigLocationin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
setConfigLocations
- Specified by:
setConfigLocationsin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getConfigLocations
- Specified by:
getConfigLocationsin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
postProcessBeanFactory
protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) Register ServletContextAwareProcessor.- Overrides:
postProcessBeanFactoryin classorg.springframework.context.support.AbstractApplicationContext- See Also:
-
ServletContextAwareProcessor
-
getResourceByPath
This implementation supports file paths beneath the root of the ServletContext.- Overrides:
getResourceByPathin classorg.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:
getResourcePatternResolverin classorg.springframework.context.support.AbstractApplicationContext- See Also:
-
ServletContextResourcePatternResolver
-
prepareBeanFactory
protected void prepareBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) - Overrides:
prepareBeanFactoryin classorg.grails.spring.GrailsApplicationContext
-
setServletConfig
public void setServletConfig(jakarta.servlet.ServletConfig servletConfig) - Specified by:
setServletConfigin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
getServletConfig
public jakarta.servlet.ServletConfig getServletConfig()- Specified by:
getServletConfigin interfaceorg.springframework.web.context.ConfigurableWebApplicationContext
-
createEnvironment
protected org.springframework.core.env.ConfigurableEnvironment createEnvironment()- Overrides:
createEnvironmentin classorg.springframework.context.support.AbstractApplicationContext
-
getEnvironment
public org.springframework.web.context.ConfigurableWebEnvironment getEnvironment()- Specified by:
getEnvironmentin interfaceorg.springframework.context.ConfigurableApplicationContext- Specified by:
getEnvironmentin interfaceorg.springframework.core.env.EnvironmentCapable- Overrides:
getEnvironmentin classorg.springframework.context.support.AbstractApplicationContext
-