接口 WebApplicationContext
- 所有超级接口:
ApplicationContext,ApplicationEventPublisher,BeanFactory,EnvironmentCapable,HierarchicalBeanFactory,ListableBeanFactory,MessageSource,ResourceLoader,ResourcePatternResolver
- 所有已知实现类:
AbstractRefreshablePortletApplicationContext,AbstractRefreshableWebApplicationContext,AnnotationConfigWebApplicationContext,GenericWebApplicationContext,GroovyWebApplicationContext,StaticPortletApplicationContext,StaticWebApplicationContext,XmlPortletApplicationContext,XmlWebApplicationContext
public interface WebApplicationContext extends ApplicationContext
Interface to provide configuration for a web application. This is read-only while the application is running, but may be reloaded if the implementation supports this.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
ServletContextAwarebeans and invoke thesetServletContextmethod accordingly.- 从以下版本开始:
- January 19, 2001
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
ServletContextAware.setServletContext(javax.servlet.ServletContext)
字段概要
字段 修饰符和类型 字段 说明 static StringCONTEXT_ATTRIBUTES_BEAN_NAMEName of the ServletContext/PortletContext attributes environment bean in the factory.static StringCONTEXT_PARAMETERS_BEAN_NAMEName of the ServletContext/PortletContext init-params environment bean in the factory.static StringROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTEContext attribute to bind root WebApplicationContext to on successful startup.static StringSCOPE_APPLICATIONScope identifier for the global web application scope: "application".static StringSCOPE_GLOBAL_SESSIONScope identifier for global session scope: "globalSession".static StringSCOPE_REQUESTScope identifier for request scope: "request".static StringSCOPE_SESSIONScope identifier for session scope: "session".static StringSERVLET_CONTEXT_BEAN_NAMEName of the ServletContext environment bean in the factory.从接口继承的字段 org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
从接口继承的字段 org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
从接口继承的字段 org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ServletContextgetServletContext()Return the standard Servlet API ServletContext for this application.从接口继承的方法 org.springframework.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
从接口继承的方法 org.springframework.context.ApplicationEventPublisher
publishEvent, publishEvent
从接口继承的方法 org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
从接口继承的方法 org.springframework.core.env.EnvironmentCapable
getEnvironment
从接口继承的方法 org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
从接口继承的方法 org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
从接口继承的方法 org.springframework.context.MessageSource
getMessage, getMessage, getMessage
从接口继承的方法 org.springframework.core.io.ResourceLoader
getClassLoader, getResource
从接口继承的方法 org.springframework.core.io.support.ResourcePatternResolver
getResources
字段详细资料
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
static final String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
Context 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.
SCOPE_REQUEST
static final String SCOPE_REQUEST
Scope identifier for request scope: "request". Supported in addition to the standard scopes "singleton" and "prototype".- 另请参阅:
- 常量字段值
SCOPE_SESSION
static final String SCOPE_SESSION
Scope identifier for session scope: "session". Supported in addition to the standard scopes "singleton" and "prototype".- 另请参阅:
- 常量字段值
SCOPE_GLOBAL_SESSION
static final String SCOPE_GLOBAL_SESSION
Scope identifier for global session scope: "globalSession". Supported in addition to the standard scopes "singleton" and "prototype".- 另请参阅:
- 常量字段值
SCOPE_APPLICATION
static final String SCOPE_APPLICATION
Scope identifier for the global web application scope: "application". Supported in addition to the standard scopes "singleton" and "prototype".- 另请参阅:
- 常量字段值
SERVLET_CONTEXT_BEAN_NAME
static final String SERVLET_CONTEXT_BEAN_NAME
Name of the ServletContext environment bean in the factory.- 另请参阅:
ServletContext, 常量字段值
CONTEXT_PARAMETERS_BEAN_NAME
static final String CONTEXT_PARAMETERS_BEAN_NAME
Name of the ServletContext/PortletContext init-params environment bean in the factory.Note: Possibly merged with ServletConfig/PortletConfig parameters. ServletConfig parameters override ServletContext parameters of the same name.
CONTEXT_ATTRIBUTES_BEAN_NAME
static final String CONTEXT_ATTRIBUTES_BEAN_NAME
Name of the ServletContext/PortletContext attributes environment bean in the factory.
方法详细资料
getServletContext
ServletContext getServletContext()
Return the standard Servlet API ServletContext for this application.Also available for a Portlet application, in addition to the PortletContext.