java.lang.Object | |
↳ | org.springframework.web.context.support.WebApplicationContextUtils |
Convenience methods for retrieving the root
WebApplicationContext
for a given
ServletContext
. This is e.g. useful for accessing a Spring
context from within custom web views or Struts actions.
Note that there are more convenient ways of accessing the root context for many web frameworks, either part of Spring or available as external library. This helper class is just the most generic way to access the root context.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Find the root WebApplicationContext for this web application, which is
typically loaded via
ContextLoaderListener . | |||||||||||
Find a custom WebApplicationContext for this web application.
| |||||||||||
Find the root WebApplicationContext for this web application, which is
typically loaded via
ContextLoaderListener . | |||||||||||
Replace
Servlet -based stub property sources with actual instances
populated with the given context and config objects. | |||||||||||
Replace
Servlet -based stub property sources with actual instances
populated with the given context object. | |||||||||||
Register web-specific environment beans ("contextParameters", "contextAttributes")
with the given BeanFactory, as used by the WebApplicationContext.
| |||||||||||
Register web-specific environment beans ("contextParameters", "contextAttributes")
with the given BeanFactory, as used by the WebApplicationContext.
| |||||||||||
Register web-specific scopes ("request", "session", "globalSession")
with the given BeanFactory, as used by the WebApplicationContext.
| |||||||||||
Register web-specific scopes ("request", "session", "globalSession", "application")
with the given BeanFactory, as used by the WebApplicationContext.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Find the root WebApplicationContext for this web application, which is
typically loaded via ContextLoaderListener
.
Will rethrow an exception that happened on root context startup, to differentiate between a failed context startup and no context at all.
sc | ServletContext to find the web application context for |
---|
IllegalStateException | if the root WebApplicationContext could not be found |
---|
Find a custom WebApplicationContext for this web application.
sc | ServletContext to find the web application context for |
---|---|
attrName | the name of the ServletContext attribute to look for |
null
if none
Find the root WebApplicationContext for this web application, which is
typically loaded via ContextLoaderListener
.
Will rethrow an exception that happened on root context startup, to differentiate between a failed context startup and no context at all.
sc | ServletContext to find the web application context for |
---|
null
if noneReplace Servlet
-based stub property sources with actual instances
populated with the given context and config objects.
Replace Servlet
-based stub property sources with actual instances
populated with the given context object.
Register web-specific environment beans ("contextParameters", "contextAttributes") with the given BeanFactory, as used by the WebApplicationContext.
bf | the BeanFactory to configure |
---|---|
sc | the ServletContext that we're running within |
Register web-specific environment beans ("contextParameters", "contextAttributes") with the given BeanFactory, as used by the WebApplicationContext.
bf | the BeanFactory to configure |
---|---|
sc | the ServletContext that we're running within |
config | the ServletConfig of the containing Portlet |
Register web-specific scopes ("request", "session", "globalSession") with the given BeanFactory, as used by the WebApplicationContext.
beanFactory | the BeanFactory to configure |
---|
Register web-specific scopes ("request", "session", "globalSession", "application") with the given BeanFactory, as used by the WebApplicationContext.
beanFactory | the BeanFactory to configure |
---|---|
sc | the ServletContext that we're running within |