public class EmbeddedWebApplicationContext
extends GenericWebApplicationContext
WebApplicationContext that can be used to bootstrap itself from a contained
 EmbeddedServletContainerFactory bean.
 
 This context will create, initialize and run an EmbeddedServletContainer by
 searching for a single EmbeddedServletContainerFactory bean within the
 ApplicationContext itself. The EmbeddedServletContainerFactory is free
 to use standard Spring concepts (such as dependency injection, lifecycle callbacks and
 property placeholder variables).
 
 In addition, any Servlet or Filter beans defined in the context will be
 automatically registered with the embedded Servlet container. In the case of a single
 Servlet bean, the '/' mapping will be used. If multiple Servlet beans are found then
 the lowercase bean name will be used as a mapping prefix. Any Servlet named
 'dispatcherServlet' will always be mapped to '/'. Filter beans will be mapped to all
 URLs ('/*').
 
 For more advanced configuration, the context can instead define beans that implement
 the ServletContextInitializer interface (most often
 ServletRegistrationBeans and/or FilterRegistrationBeans). To prevent
 double registration, the use of ServletContextInitializer beans will disable
 automatic Servlet and Filter bean registration.
 
 Although this context can be used directly, most developers should consider using the
 AnnotationConfigEmbeddedWebApplicationContext or
 XmlEmbeddedWebApplicationContext variants.
AnnotationConfigEmbeddedWebApplicationContext, 
XmlEmbeddedWebApplicationContext, 
EmbeddedServletContainerFactory| Modifier and Type | Class and Description | 
|---|---|
| static class  | EmbeddedWebApplicationContext.ExistingWebApplicationScopesUtility class to store and restore any user defined scopes. | 
| Modifier and Type | Field and Description | 
|---|---|
| static String | DISPATCHER_SERVLET_NAMEConstant value for the DispatcherServlet bean name. | 
| Constructor and Description | 
|---|
| EmbeddedWebApplicationContext() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | doClose() | 
| protected void | finishRefresh() | 
| EmbeddedServletContainer | getEmbeddedServletContainer()Returns the  EmbeddedServletContainerthat was created by the context ornullif the container has not yet been created. | 
| protected EmbeddedServletContainerFactory | getEmbeddedServletContainerFactory()Returns the  EmbeddedServletContainerFactorythat should be used to create
 the embedded servlet container. | 
| String | getNamespace() | 
| protected Resource | getResourceByPath(String path) | 
| ServletConfig | getServletConfig() | 
| protected Collection<ServletContextInitializer> | getServletContextInitializerBeans()Returns  ServletContextInitializers that should be used with the embedded
 Servlet context. | 
| protected void | onRefresh() | 
| protected void | postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)Register ServletContextAwareProcessor. | 
| protected void | prepareEmbeddedWebApplicationContext(ServletContext servletContext)Prepare the  WebApplicationContextwith the given fully loadedServletContext. | 
| void | refresh() | 
| void | setNamespace(String namespace) | 
| void | setServletConfig(ServletConfig servletConfig) | 
public static final String DISPATCHER_SERVLET_NAME
ServletRegistrationBean or a different bean name.protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
ServletContextAwareProcessorpublic final void refresh()
                   throws BeansException,
                          IllegalStateException
BeansExceptionIllegalStateExceptionprotected void onRefresh()
protected void finishRefresh()
protected void doClose()
protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory()
EmbeddedServletContainerFactory that should be used to create
 the embedded servlet container. By default this method searches for a suitable bean
 in the context itself.EmbeddedServletContainerFactory (never null)protected Collection<ServletContextInitializer> getServletContextInitializerBeans()
ServletContextInitializers that should be used with the embedded
 Servlet context. By default this method will first attempt to find
 ServletContextInitializer, Servlet, Filter and certain
 EventListener beans.protected void prepareEmbeddedWebApplicationContext(ServletContext servletContext)
WebApplicationContext with the given fully loaded
 ServletContext. This method is usually called from
 ServletContextInitializer.onStartup(ServletContext) and is similar to the
 functionality usually provided by a ContextLoaderListener.servletContext - the operational servlet contextpublic void setNamespace(String namespace)
public String getNamespace()
public void setServletConfig(ServletConfig servletConfig)
public ServletConfig getServletConfig()
public EmbeddedServletContainer getEmbeddedServletContainer()
EmbeddedServletContainer that was created by the context or
 null if the container has not yet been created.Copyright © 2015 Pivotal Software, Inc.. All rights reserved.