public class ServletWebServerApplicationContext extends org.springframework.web.context.support.GenericWebApplicationContext implements ConfigurableWebServerApplicationContext
WebApplicationContext that can be used to bootstrap itself from a contained
 ServletWebServerFactory bean.
 
 This context will create, initialize and run an WebServer by searching for a
 single ServletWebServerFactory bean within the ApplicationContext
 itself. The ServletWebServerFactory 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 web server. 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
 AnnotationConfigServletWebServerApplicationContext or
 XmlServletWebServerApplicationContext variants.
AnnotationConfigServletWebServerApplicationContext, 
XmlServletWebServerApplicationContext, 
ServletWebServerFactory| Modifier and Type | Class and Description | 
|---|---|
| static class  | ServletWebServerApplicationContext.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. | 
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAMECONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAMECLASSPATH_ALL_URL_PREFIX| Constructor and Description | 
|---|
| ServletWebServerApplicationContext()Create a new  ServletWebServerApplicationContext. | 
| ServletWebServerApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)Create a new  ServletWebServerApplicationContextwith the givenDefaultListableBeanFactory. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | finishRefresh() | 
| protected org.springframework.core.io.Resource | getResourceByPath(String path) | 
| String | getServerNamespace()Returns the namespace of the web server application context or  nullif no
 namespace has been set. | 
| javax.servlet.ServletConfig | getServletConfig() | 
| protected Collection<ServletContextInitializer> | getServletContextInitializerBeans()Returns  ServletContextInitializers that should be used with the embedded
 web server. | 
| WebServer | getWebServer()Returns the  WebServerthat was created by the context ornullif
 the server has not yet been created. | 
| protected ServletWebServerFactory | getWebServerFactory()Returns the  ServletWebServerFactorythat should be used to create the
 embeddedWebServer. | 
| protected void | onClose() | 
| protected void | onRefresh() | 
| protected void | postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)Register ServletContextAwareProcessor. | 
| protected void | prepareWebApplicationContext(javax.servlet.ServletContext servletContext)Prepare the  WebApplicationContextwith the given fully loadedServletContext. | 
| void | refresh() | 
| void | setServerNamespace(String serverNamespace)Set the server namespace of the context. | 
| void | setServletConfig(javax.servlet.ServletConfig servletConfig) | 
createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourcePatternResolver, getServletContext, getTheme, initPropertySources, setConfigLocation, setConfigLocations, setNamespace, setServletContextcancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getClassLoader, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setClassLoader, setParent, setResourceLoaderaddApplicationListener, addBeanFactoryPostProcessor, assertBeanFactoryActive, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, getAliases, getApplicationListeners, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toStringaddProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCacheclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, registerShutdownHook, setEnvironment, setId, setParenthasServerNamespacegetApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDatecontainsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotationcontainsLocalBean, getParentBeanFactorycontainsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchgetMessage, getMessage, getMessagepublishEvent, publishEventgetResourcesgetClassLoader, getResourcepublic static final String DISPATCHER_SERVLET_NAME
ServletRegistrationBean or a different bean name.public ServletWebServerApplicationContext()
ServletWebServerApplicationContext.public ServletWebServerApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
ServletWebServerApplicationContext with the given
 DefaultListableBeanFactory.beanFactory - the DefaultListableBeanFactory instance to use for this contextprotected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
postProcessBeanFactory in class org.springframework.web.context.support.GenericWebApplicationContextServletContextAwareProcessorpublic final void refresh()
                   throws org.springframework.beans.BeansException,
                          IllegalStateException
refresh in interface org.springframework.context.ConfigurableApplicationContextrefresh in class org.springframework.context.support.AbstractApplicationContextorg.springframework.beans.BeansExceptionIllegalStateExceptionprotected void onRefresh()
onRefresh in class org.springframework.web.context.support.GenericWebApplicationContextprotected void finishRefresh()
finishRefresh in class org.springframework.context.support.AbstractApplicationContextprotected void onClose()
onClose in class org.springframework.context.support.AbstractApplicationContextprotected ServletWebServerFactory getWebServerFactory()
ServletWebServerFactory that should be used to create the
 embedded WebServer. By default this method searches for a suitable bean in
 the context itself.ServletWebServerFactory (never null)protected Collection<ServletContextInitializer> getServletContextInitializerBeans()
ServletContextInitializers that should be used with the embedded
 web server. By default this method will first attempt to find
 ServletContextInitializer, Servlet, Filter and certain
 EventListener beans.protected void prepareWebApplicationContext(javax.servlet.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 contextprotected org.springframework.core.io.Resource getResourceByPath(String path)
getResourceByPath in class org.springframework.web.context.support.GenericWebApplicationContextpublic String getServerNamespace()
WebServerApplicationContextnull if no
 namespace has been set. Used for disambiguation when multiple web servers are
 running in the same application (for example a management context running on a
 different port).getServerNamespace in interface WebServerApplicationContextpublic void setServerNamespace(String serverNamespace)
ConfigurableWebServerApplicationContextsetServerNamespace in interface ConfigurableWebServerApplicationContextserverNamespace - the server namespaceWebServerApplicationContext.getServerNamespace()public void setServletConfig(javax.servlet.ServletConfig servletConfig)
setServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContextsetServletConfig in class org.springframework.web.context.support.GenericWebApplicationContextpublic javax.servlet.ServletConfig getServletConfig()
getServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContextgetServletConfig in class org.springframework.web.context.support.GenericWebApplicationContextpublic WebServer getWebServer()
WebServer that was created by the context or null if
 the server has not yet been created.getWebServer in interface WebServerApplicationContextCopyright © 2020 Pivotal Software, Inc.. All rights reserved.