org.springframework.web.context.WebApplicationContext |
Known Indirect Subclasses
|
Class Overview
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 ServletContextAware
beans and invoke the setServletContext
method accordingly.
Summary
Public Methods |
abstract
ServletContext
|
getServletContext()
Return the standard Servlet API ServletContext for this application.
|
[Expand]
Inherited Methods |
From interface
org.springframework.beans.factory.BeanFactory
abstract
boolean
|
containsBean(String name)
Does this bean factory contain a bean with the given name? More specifically,
is getBean(Class) able to obtain a bean instance for the given name?
Translates aliases back to the corresponding canonical bean name.
|
abstract
String[]
|
getAliases(String name)
Return the aliases for the given bean name, if any.
|
abstract
Object
|
getBean(String name)
Return an instance, which may be shared or independent, of the specified bean.
|
abstract
Object
|
getBean(String name, Object... args)
Return an instance, which may be shared or independent, of the specified bean.
|
abstract
<T>
T
|
getBean(Class<T> requiredType)
Return the bean instance that uniquely matches the given object type, if any.
|
abstract
<T>
T
|
getBean(String name, Class<T> requiredType)
Return an instance, which may be shared or independent, of the specified bean.
|
abstract
Class<?>
|
getType(String name)
Determine the type of the bean with the given name.
|
abstract
boolean
|
isPrototype(String name)
Is this bean a prototype? That is, will getBean(Class) always return
independent instances?
Note: This method returning false does not clearly indicate
a singleton object.
|
abstract
boolean
|
isSingleton(String name)
Is this bean a shared singleton? That is, will getBean(Class) always
return the same instance?
Note: This method returning false does not clearly indicate
independent instances.
|
abstract
boolean
|
isTypeMatch(String name, Class<?> targetType)
Check whether the bean with the given name matches the specified type.
|
|
From interface
org.springframework.beans.factory.HierarchicalBeanFactory
|
From interface
org.springframework.beans.factory.ListableBeanFactory
abstract
boolean
|
containsBeanDefinition(String beanName)
Check if this bean factory contains a bean definition with the given name.
|
abstract
<A extends Annotation>
A
|
findAnnotationOnBean(String beanName, Class<A> annotationType)
Find a Annotation of annotationType on the specified
bean, traversing its interfaces and super classes if no annotation can be
found on the given class itself.
|
abstract
int
|
getBeanDefinitionCount()
Return the number of beans defined in the factory.
|
abstract
String[]
|
getBeanDefinitionNames()
Return the names of all beans defined in this factory.
|
abstract
String[]
|
getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
Return the names of beans matching the given type (including subclasses),
judging from either bean definitions or the value of getObjectType
in the case of FactoryBeans.
|
abstract
String[]
|
getBeanNamesForType(Class<?> type)
Return the names of beans matching the given type (including subclasses),
judging from either bean definitions or the value of getObjectType
in the case of FactoryBeans.
|
abstract
<T>
Map<String, T>
|
getBeansOfType(Class<T> type)
Return the bean instances that match the given object type (including
subclasses), judging from either bean definitions or the value of
getObjectType in the case of FactoryBeans.
|
abstract
<T>
Map<String, T>
|
getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
Return the bean instances that match the given object type (including
subclasses), judging from either bean definitions or the value of
getObjectType in the case of FactoryBeans.
|
abstract
Map<String, Object>
|
getBeansWithAnnotation(Class<? extends Annotation> annotationType)
Find all beans whose Class has the supplied Annotation type.
|
|
From interface
org.springframework.context.ApplicationContext
|
From interface
org.springframework.context.ApplicationEventPublisher
|
From interface
org.springframework.context.MessageSource
|
From interface
org.springframework.core.env.EnvironmentCapable
|
From interface
org.springframework.core.io.ResourceLoader
|
From interface
org.springframework.core.io.support.ResourcePatternResolver
|
Constants
public
static
final
String
CONTEXT_ATTRIBUTES_BEAN_NAME
Name of the ServletContext/PortletContext attributes environment bean in the factory.
Constant Value:
"contextAttributes"
public
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.
Constant Value:
"contextParameters"
public
static
final
String
SCOPE_APPLICATION
Scope identifier for the global web application scope: "application".
Supported in addition to the standard scopes "singleton" and "prototype".
Constant Value:
"application"
public
static
final
String
SCOPE_GLOBAL_SESSION
Scope identifier for global session scope: "globalSession".
Supported in addition to the standard scopes "singleton" and "prototype".
Constant Value:
"globalSession"
public
static
final
String
SCOPE_REQUEST
Scope identifier for request scope: "request".
Supported in addition to the standard scopes "singleton" and "prototype".
Constant Value:
"request"
public
static
final
String
SCOPE_SESSION
Scope identifier for session scope: "session".
Supported in addition to the standard scopes "singleton" and "prototype".
Constant Value:
"session"
public
static
final
String
SERVLET_CONTEXT_BEAN_NAME
Name of the ServletContext environment bean in the factory.
See Also
- javax.servlet.ServletContext
Constant Value:
"servletContext"
Fields
public
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.
Public Methods
public
abstract
ServletContext
getServletContext
()
Return the standard Servlet API ServletContext for this application.
Also available for a Portlet application, in addition to the PortletContext.