public interface WebApplicationContext extends ApplicationContext
This interface adds a getServletContext()
method to the generic
ApplicationContext interface, and defines a well-known application attribute name
that the root context must be bound to in the bootstrap process.
Like generic application contexts, web application contexts are hierarchical. There is a single root context per application, while each servlet in the application (including a dispatcher servlet in the MVC framework) has its own child context.
In addition to standard application context lifecycle capabilities,
WebApplicationContext implementations need to detect ServletContextAware
beans and invoke the setServletContext
method accordingly.
ServletContextAware.setServletContext(javax.servlet.ServletContext)
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_ATTRIBUTES_BEAN_NAME
Name of the ServletContext/PortletContext attributes environment bean in the factory.
|
static String |
CONTEXT_PARAMETERS_BEAN_NAME
Name of the ServletContext/PortletContext init-params environment bean in the factory.
|
static String |
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
Context attribute to bind root WebApplicationContext to on successful startup.
|
static String |
SCOPE_APPLICATION
Scope identifier for the global web application scope: "application".
|
static String |
SCOPE_GLOBAL_SESSION
Scope identifier for global session scope: "globalSession".
|
static String |
SCOPE_REQUEST
Scope identifier for request scope: "request".
|
static String |
SCOPE_SESSION
Scope identifier for session scope: "session".
|
static String |
SERVLET_CONTEXT_BEAN_NAME
Name of the ServletContext environment bean in the factory.
|
FACTORY_BEAN_PREFIX
CLASSPATH_ALL_URL_PREFIX
CLASSPATH_URL_PREFIX
Modifier and Type | Method and Description |
---|---|
ServletContext |
getServletContext()
Return the standard Servlet API ServletContext for this application.
|
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
getEnvironment
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
containsLocalBean, getParentBeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch
getMessage, getMessage, getMessage
publishEvent
getResources
getClassLoader, getResource
static final String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
Note: If the startup of the root context fails, this attribute can contain an exception or error as value. Use WebApplicationContextUtils for convenient lookup of the root WebApplicationContext.
static final String SCOPE_REQUEST
static final String SCOPE_SESSION
static final String SCOPE_GLOBAL_SESSION
static final String SCOPE_APPLICATION
static final String SERVLET_CONTEXT_BEAN_NAME
ServletContext
,
Constant Field Valuesstatic final String CONTEXT_PARAMETERS_BEAN_NAME
Note: Possibly merged with ServletConfig/PortletConfig parameters. ServletConfig parameters override ServletContext parameters of the same name.
static final String CONTEXT_ATTRIBUTES_BEAN_NAME
ServletContext getServletContext()
Also available for a Portlet application, in addition to the PortletContext.