接口的使用
org.springframework.web.context.WebApplicationContext
使用WebApplicationContext的程序包 程序包 说明 org.springframework.test.web.servlet Contains server-side support for testing Spring MVC applications.org.springframework.test.web.servlet.htmlunit Server-side support for testing Spring MVC applications withMockMvc
and HtmlUnit.org.springframework.test.web.servlet.htmlunit.webdriver Server-side support for testing Spring MVC applications withMockMvc
and the SeleniumHtmlUnitDriver
.org.springframework.test.web.servlet.setup Contains built-inMockMvcBuilder
implementations.org.springframework.web.bind.support Support classes for web data binding.org.springframework.web.context Contains a variant of the application context interface for web applications, and the ContextLoaderListener that bootstraps a root web application context.org.springframework.web.context.support Classes supporting theorg.springframework.web.context
package, such as WebApplicationContext implementations and various utility classes.org.springframework.web.filter Provides generic filter base classes allowing for bean-style configuration.org.springframework.web.jsf Support classes for integrating a JSF web layer with a Spring service layer which is hosted in a Spring root WebApplicationContext.org.springframework.web.jsf.el ELResolvers for integrating a JSF web layer with a Spring service layer which is hosted in a Spring root WebApplicationContext.org.springframework.web.servlet Provides servlets that integrate with the application context infrastructure, and the core interfaces and classes for the Spring web MVC framework.org.springframework.web.servlet.support Support classes for Spring's web MVC framework.org.springframework.web.servlet.view.tiles3 Support classes for the integration of Tiles 3 (the standalone version of Tiles) as Spring web view technology.org.springframework.test.web.servlet中WebApplicationContext的使用
参数类型为WebApplicationContext的org.springframework.test.web.servlet中的方法 修饰符和类型 方法 说明 protected MockMvc
MockMvcBuilderSupport. createMockMvc(Filter[] filters, MockServletConfig servletConfig, WebApplicationContext webAppContext, RequestBuilder defaultRequestBuilder, List<ResultMatcher> globalResultMatchers, List<ResultHandler> globalResultHandlers, List<DispatcherServletCustomizer> dispatcherServletCustomizers)
org.springframework.test.web.servlet.htmlunit中WebApplicationContext的使用
参数类型为WebApplicationContext的org.springframework.test.web.servlet.htmlunit中的方法 修饰符和类型 方法 说明 static MockMvcWebClientBuilder
MockMvcWebClientBuilder. webAppContextSetup(WebApplicationContext context)
Create a newMockMvcWebClientBuilder
based on the suppliedWebApplicationContext
.static MockMvcWebClientBuilder
MockMvcWebClientBuilder. webAppContextSetup(WebApplicationContext context, MockMvcConfigurer configurer)
Create a newMockMvcWebClientBuilder
based on the suppliedWebApplicationContext
andMockMvcConfigurer
.参数类型为WebApplicationContext的org.springframework.test.web.servlet.htmlunit中的构造器 构造器 说明 MockMvcWebClientBuilder(WebApplicationContext context)
MockMvcWebClientBuilder(WebApplicationContext context, MockMvcConfigurer configurer)
MockMvcWebConnectionBuilderSupport(WebApplicationContext context)
Create a new instance using the suppliedWebApplicationContext
.MockMvcWebConnectionBuilderSupport(WebApplicationContext context, MockMvcConfigurer configurer)
Create a new instance using the suppliedWebApplicationContext
andMockMvcConfigurer
.org.springframework.test.web.servlet.htmlunit.webdriver中WebApplicationContext的使用
参数类型为WebApplicationContext的org.springframework.test.web.servlet.htmlunit.webdriver中的方法 修饰符和类型 方法 说明 static MockMvcHtmlUnitDriverBuilder
MockMvcHtmlUnitDriverBuilder. webAppContextSetup(WebApplicationContext context)
Create a newMockMvcHtmlUnitDriverBuilder
based on the suppliedWebApplicationContext
.static MockMvcHtmlUnitDriverBuilder
MockMvcHtmlUnitDriverBuilder. webAppContextSetup(WebApplicationContext context, MockMvcConfigurer configurer)
Create a newMockMvcHtmlUnitDriverBuilder
based on the suppliedWebApplicationContext
andMockMvcConfigurer
.参数类型为WebApplicationContext的org.springframework.test.web.servlet.htmlunit.webdriver中的构造器 构造器 说明 MockMvcHtmlUnitDriverBuilder(WebApplicationContext context)
MockMvcHtmlUnitDriverBuilder(WebApplicationContext context, MockMvcConfigurer configurer)
org.springframework.test.web.servlet.setup中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.test.web.servlet.setup中的方法 修饰符和类型 方法 说明 protected abstract WebApplicationContext
AbstractMockMvcBuilder. initWebAppContext()
A method to obtain theWebApplicationContext
to be passed to theDispatcherServlet
.protected WebApplicationContext
DefaultMockMvcBuilder. initWebAppContext()
protected WebApplicationContext
StandaloneMockMvcBuilder. initWebAppContext()
参数类型为WebApplicationContext的org.springframework.test.web.servlet.setup中的方法 修饰符和类型 方法 说明 default RequestPostProcessor
MockMvcConfigurer. beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext context)
Invoked when the MockMvc instance is about to be created with the MockMvc builder and the Spring WebApplicationContext that will be passed to theDispatcherServlet
.RequestPostProcessor
MockMvcConfigurerAdapter. beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext cxt)
RequestPostProcessor
SharedHttpSessionConfigurer. beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext context)
static DefaultMockMvcBuilder
MockMvcBuilders. webAppContextSetup(WebApplicationContext context)
Build aMockMvc
instance using the given, fully initialized (i.e., refreshed)WebApplicationContext
.参数类型为WebApplicationContext的org.springframework.test.web.servlet.setup中的构造器 构造器 说明 DefaultMockMvcBuilder(WebApplicationContext webAppContext)
Protected constructor.org.springframework.web.bind.support中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.bind.support中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
SpringWebConstraintValidatorFactory. getWebApplicationContext()
Retrieve the SpringWebApplicationContext
to use.org.springframework.web.context中WebApplicationContext的使用
org.springframework.web.context中WebApplicationContext的子接口 修饰符和类型 接口 说明 interface
ConfigurableWebApplicationContext
Interface to be implemented by configurable web application contexts.返回WebApplicationContext的org.springframework.web.context中的方法 修饰符和类型 方法 说明 protected abstract WebApplicationContext
AbstractContextLoaderInitializer. createRootApplicationContext()
Create the "root" application context to be provided to theContextLoaderListener
.protected WebApplicationContext
ContextLoader. createWebApplicationContext(ServletContext sc)
Instantiate the root WebApplicationContext for this loader, either the default context class or a custom context class if specified.static WebApplicationContext
ContextLoader. getCurrentWebApplicationContext()
Obtain the Spring root web application context for the current thread (i.e. for the current thread's context ClassLoader, which needs to be the web application's ClassLoader).WebApplicationContext
ContextLoader. initWebApplicationContext(ServletContext servletContext)
Initialize Spring's web application context for the given servlet context, using the application context provided at construction time, or creating a new one according to the "contextClass
" and "contextConfigLocation
" context-params.参数类型为WebApplicationContext的org.springframework.web.context中的构造器 构造器 说明 ContextLoader(WebApplicationContext context)
Create a newContextLoader
with the given application context.ContextLoaderListener(WebApplicationContext context)
Create a newContextLoaderListener
with the given application context.org.springframework.web.context.support中WebApplicationContext的使用
实现WebApplicationContext的org.springframework.web.context.support中的类 修饰符和类型 类 说明 class
AbstractRefreshableWebApplicationContext
AbstractRefreshableApplicationContext
subclass which implements theConfigurableWebApplicationContext
interface for web environments.class
AnnotationConfigWebApplicationContext
WebApplicationContext
implementation which accepts component classes as input — in particular@Configuration
-annotated classes, but also plain@Component
classes and JSR-330 compliant classes usingjavax.inject
annotations.class
GenericWebApplicationContext
Subclass ofGenericApplicationContext
, suitable for web environments.class
GroovyWebApplicationContext
WebApplicationContext
implementation which takes its configuration from Groovy bean definition scripts and/or XML files, as understood by aGroovyBeanDefinitionReader
.class
StaticWebApplicationContext
StaticWebApplicationContext
implementation for testing.class
XmlWebApplicationContext
WebApplicationContext
implementation which takes its configuration from XML documents, understood by anXmlBeanDefinitionReader
.返回WebApplicationContext的org.springframework.web.context.support中的方法 修饰符和类型 方法 说明 static WebApplicationContext
WebApplicationContextUtils. findWebApplicationContext(ServletContext sc)
Find a uniqueWebApplicationContext
for this web app: either the root web app context (preferred) or a uniqueWebApplicationContext
among the registeredServletContext
attributes (typically coming from a singleDispatcherServlet
in the current web application).static WebApplicationContext
WebApplicationContextUtils. getRequiredWebApplicationContext(ServletContext sc)
Find the rootWebApplicationContext
for this web app, typically loaded viaContextLoaderListener
.WebApplicationContext
ContextExposingHttpServletRequest. getWebApplicationContext()
Return the WebApplicationContext that this request runs in.static WebApplicationContext
WebApplicationContextUtils. getWebApplicationContext(ServletContext sc)
Find the rootWebApplicationContext
for this web app, typically loaded viaContextLoaderListener
.static WebApplicationContext
WebApplicationContextUtils. getWebApplicationContext(ServletContext sc, String attrName)
Find a customWebApplicationContext
for this web app.protected WebApplicationContext
WebApplicationObjectSupport. getWebApplicationContext()
Return the current application context as WebApplicationContext.参数类型为WebApplicationContext的org.springframework.web.context.support中的构造器 构造器 说明 ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context)
Create a new ContextExposingHttpServletRequest for the given request.ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context, Set<String> exposedContextBeanNames)
Create a new ContextExposingHttpServletRequest for the given request.org.springframework.web.filter中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.filter中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
DelegatingFilterProxy. findWebApplicationContext()
Return theWebApplicationContext
passed in at construction time, if available.参数类型为WebApplicationContext的org.springframework.web.filter中的方法 修饰符和类型 方法 说明 protected Filter
DelegatingFilterProxy. initDelegate(WebApplicationContext wac)
Initialize the Filter delegate, defined as bean the given Spring application context.参数类型为WebApplicationContext的org.springframework.web.filter中的构造器 构造器 说明 DelegatingFilterProxy(String targetBeanName, WebApplicationContext wac)
Create a newDelegatingFilterProxy
that will retrieve the named target bean from the given SpringWebApplicationContext
.org.springframework.web.jsf中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.jsf中的方法 修饰符和类型 方法 说明 static WebApplicationContext
FacesContextUtils. getRequiredWebApplicationContext(FacesContext fc)
Find the rootWebApplicationContext
for this web app, typically loaded viaContextLoaderListener
.protected WebApplicationContext
DelegatingNavigationHandlerProxy. getWebApplicationContext(FacesContext facesContext)
Retrieve the web application context to delegate bean name resolution to.protected WebApplicationContext
DelegatingPhaseListenerMulticaster. getWebApplicationContext(FacesContext facesContext)
Retrieve the web application context to delegate bean name resolution to.static WebApplicationContext
FacesContextUtils. getWebApplicationContext(FacesContext fc)
Find the rootWebApplicationContext
for this web app, typically loaded viaContextLoaderListener
.org.springframework.web.jsf.el中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.jsf.el中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
SpringBeanFacesELResolver. getWebApplicationContext(ELContext elContext)
Retrieve the web application context to delegate bean name resolution to.protected WebApplicationContext
WebApplicationContextFacesELResolver. getWebApplicationContext(ELContext elContext)
Retrieve theWebApplicationContext
reference to expose.org.springframework.web.servlet中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.servlet中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
FrameworkServlet. createWebApplicationContext(ApplicationContext parent)
Instantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContext
or acustom context class
, if set.protected WebApplicationContext
FrameworkServlet. createWebApplicationContext(WebApplicationContext parent)
Instantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContext
or acustom context class
, if set.protected WebApplicationContext
FrameworkServlet. findWebApplicationContext()
WebApplicationContext
FrameworkServlet. getWebApplicationContext()
Return this servlet's WebApplicationContext.protected WebApplicationContext
FrameworkServlet. initWebApplicationContext()
Initialize and publish the WebApplicationContext for this servlet.参数类型为WebApplicationContext的org.springframework.web.servlet中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
FrameworkServlet. createWebApplicationContext(WebApplicationContext parent)
Instantiate the WebApplicationContext for this servlet, either a defaultXmlWebApplicationContext
or acustom context class
, if set.参数类型为WebApplicationContext的org.springframework.web.servlet中的构造器 构造器 说明 DispatcherServlet(WebApplicationContext webApplicationContext)
Create a newDispatcherServlet
with the given web application context.FrameworkServlet(WebApplicationContext webApplicationContext)
Create a newFrameworkServlet
with the given web application context.org.springframework.web.servlet.support中WebApplicationContext的使用
返回WebApplicationContext的org.springframework.web.servlet.support中的方法 修饰符和类型 方法 说明 protected WebApplicationContext
AbstractAnnotationConfigDispatcherServletInitializer. createRootApplicationContext()
Create the "root" application context to be provided to theContextLoaderListener
.protected WebApplicationContext
AbstractAnnotationConfigDispatcherServletInitializer. createServletApplicationContext()
Create a servlet application context to be provided to theDispatcherServlet
.protected abstract WebApplicationContext
AbstractDispatcherServletInitializer. createServletApplicationContext()
Create a servlet application context to be provided to theDispatcherServlet
.static WebApplicationContext
RequestContextUtils. findWebApplicationContext(HttpServletRequest request)
Look for the WebApplicationContext associated with the DispatcherServlet that has initiated request processing, and for the global context if none was found associated with the current request.static WebApplicationContext
RequestContextUtils. findWebApplicationContext(HttpServletRequest request, ServletContext servletContext)
Look for the WebApplicationContext associated with the DispatcherServlet that has initiated request processing, and for the global context if none was found associated with the current request.WebApplicationContext
RequestContext. getWebApplicationContext()
Return the current WebApplicationContext.参数类型为WebApplicationContext的org.springframework.web.servlet.support中的方法 修饰符和类型 方法 说明 protected FrameworkServlet
AbstractDispatcherServletInitializer. createDispatcherServlet(WebApplicationContext servletAppContext)
Create aDispatcherServlet
(or other kind ofFrameworkServlet
-derived dispatcher) with the specifiedWebApplicationContext
.org.springframework.web.servlet.view.tiles3中WebApplicationContext的使用
参数类型为WebApplicationContext的org.springframework.web.servlet.view.tiles3中的方法 修饰符和类型 方法 说明 protected abstract ViewPreparer
AbstractSpringPreparerFactory. getPreparer(String name, WebApplicationContext context)
Obtain a preparer instance for the given preparer name, based on the given Spring WebApplicationContext.protected ViewPreparer
SimpleSpringPreparerFactory. getPreparer(String name, WebApplicationContext context)
protected ViewPreparer
SpringBeanPreparerFactory. getPreparer(String name, WebApplicationContext context)