Interface WebApplicationContext
- All Superinterfaces:
- ApplicationContext,- ApplicationEventPublisher,- BeanFactory,- EnvironmentCapable,- HierarchicalBeanFactory,- ListableBeanFactory,- MessageSource,- ResourceLoader,- ResourcePatternResolver
- All Known Subinterfaces:
- ConfigurableWebApplicationContext
- All Known Implementing Classes:
- AbstractRefreshableWebApplicationContext,- AnnotationConfigWebApplicationContext,- GenericWebApplicationContext,- GroovyWebApplicationContext,- StaticWebApplicationContext,- XmlWebApplicationContext
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.
- Since:
- January 19, 2001
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringName of the ServletContext attributes environment bean in the factory.static final StringName of the ServletContext init-params environment bean in the factory.static final StringContext attribute to bind root WebApplicationContext to on successful startup.static final StringScope identifier for the global web application scope: "application".static final StringScope identifier for request scope: "request".static final StringScope identifier for session scope: "session".static final StringName of the ServletContext environment bean in the factory.Fields inherited from interface org.springframework.beans.factory.BeanFactoryFACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHARFields inherited from interface org.springframework.core.io.ResourceLoaderCLASSPATH_URL_PREFIXFields inherited from interface org.springframework.core.io.support.ResourcePatternResolverCLASSPATH_ALL_URL_PREFIX
- 
Method SummaryModifier and TypeMethodDescriptionReturn the standard Servlet API ServletContext for this application.Methods inherited from interface org.springframework.context.ApplicationContextgetApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDateMethods inherited from interface org.springframework.context.ApplicationEventPublisherpublishEvent, publishEventMethods inherited from interface org.springframework.beans.factory.BeanFactorycontainsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchMethods inherited from interface org.springframework.core.env.EnvironmentCapablegetEnvironmentMethods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactorycontainsLocalBean, getParentBeanFactoryMethods inherited from interface org.springframework.beans.factory.ListableBeanFactorycontainsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotationMethods inherited from interface org.springframework.context.MessageSourcegetMessage, getMessage, getMessageMethods inherited from interface org.springframework.core.io.ResourceLoadergetClassLoader, getResourceMethods inherited from interface org.springframework.core.io.support.ResourcePatternResolvergetResources
- 
Field Details- 
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTEContext attribute to bind root WebApplicationContext to on successful startup.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. - See Also:
 
- 
SCOPE_REQUESTScope identifier for request scope: "request". Supported in addition to the standard scopes "singleton" and "prototype".- See Also:
 
- 
SCOPE_SESSIONScope identifier for session scope: "session". Supported in addition to the standard scopes "singleton" and "prototype".- See Also:
 
- 
SCOPE_APPLICATIONScope identifier for the global web application scope: "application". Supported in addition to the standard scopes "singleton" and "prototype".- See Also:
 
- 
SERVLET_CONTEXT_BEAN_NAMEName of the ServletContext environment bean in the factory.- See Also:
 
- 
CONTEXT_PARAMETERS_BEAN_NAMEName of the ServletContext init-params environment bean in the factory.Note: Possibly merged with ServletConfig parameters. ServletConfig parameters override ServletContext parameters of the same name. - See Also:
 
- 
CONTEXT_ATTRIBUTES_BEAN_NAMEName of the ServletContext attributes environment bean in the factory.- See Also:
 
 
- 
- 
Method Details- 
getServletContext@Nullable ServletContext getServletContext()Return the standard Servlet API ServletContext for this application.
 
-