org.springframework.boot.web.servlet.context

Class ServletWebServerApplicationContext

  • java.lang.Object
    • org.springframework.core.io.DefaultResourceLoader
      • org.springframework.context.support.AbstractApplicationContext
        • org.springframework.context.support.GenericApplicationContext
          • org.springframework.web.context.support.GenericWebApplicationContext
            • org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  ServletWebServerApplicationContext.ExistingWebApplicationScopes
      Utility class to store and restore any user defined scopes.
      • Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader

        org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String DISPATCHER_SERVLET_NAME
      Constant value for the DispatcherServlet bean name.
      • Fields inherited from class org.springframework.context.support.AbstractApplicationContext

        APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAME
      • Fields inherited from interface org.springframework.context.ConfigurableApplicationContext

        CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
      • Fields inherited from interface org.springframework.beans.factory.BeanFactory

        FACTORY_BEAN_PREFIX
      • Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver

        CLASSPATH_ALL_URL_PREFIX
      • Fields inherited from interface org.springframework.core.io.ResourceLoader

        CLASSPATH_URL_PREFIX
      • Fields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext

        APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAME
      • Fields inherited from interface org.springframework.web.context.WebApplicationContext

        CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected void doClose() 
      protected org.springframework.core.io.Resource getResourceByPath(java.lang.String path) 
      java.lang.String getServerNamespace()
      Returns the namespace of the web server application context or null if no namespace has been set.
      javax.servlet.ServletConfig getServletConfig() 
      protected java.util.Collection<ServletContextInitializer> getServletContextInitializerBeans()
      Returns ServletContextInitializers that should be used with the embedded web server.
      WebServer getWebServer()
      Returns the WebServer that was created by the context or null if the server has not yet been created.
      protected ServletWebServerFactory getWebServerFactory()
      Returns the ServletWebServerFactory that should be used to create the embedded WebServer.
      protected void onRefresh() 
      protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Register ServletContextAwareProcessor.
      protected void prepareWebApplicationContext(javax.servlet.ServletContext servletContext)
      Prepare the WebApplicationContext with the given fully loaded ServletContext.
      void refresh() 
      void setServerNamespace(java.lang.String serverNamespace)
      Set the server namespace of the context.
      void setServletConfig(javax.servlet.ServletConfig servletConfig) 
      • Methods inherited from class org.springframework.web.context.support.GenericWebApplicationContext

        createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourcePatternResolver, getServletContext, getTheme, initPropertySources, setConfigLocation, setConfigLocations, setNamespace, setServletContext
      • Methods inherited from class org.springframework.context.support.GenericApplicationContext

        cancelRefresh, closeBeanFactory, getAutowireCapableBeanFactory, getBeanDefinition, getBeanFactory, getClassLoader, getDefaultListableBeanFactory, getResource, getResources, isAlias, isBeanNameInUse, refreshBeanFactory, registerAlias, registerBean, registerBean, registerBean, registerBean, registerBean, registerBean, registerBeanDefinition, removeAlias, removeBeanDefinition, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setClassLoader, setParent, setResourceLoader
      • Methods inherited from class org.springframework.context.support.AbstractApplicationContext

        addApplicationListener, addBeanFactoryPostProcessor, assertBeanFactoryActive, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setId, start, stop, toString
      • Methods inherited from class org.springframework.core.io.DefaultResourceLoader

        addProtocolResolver, clearResourceCaches, getProtocolResolvers, getResourceCache
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.springframework.context.ConfigurableApplicationContext

        addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getBeanFactory, getEnvironment, isActive, registerShutdownHook, setEnvironment, setId, setParent
      • Methods inherited from interface org.springframework.context.Lifecycle

        isRunning, start, stop
      • Methods inherited from interface org.springframework.context.ApplicationContext

        getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
      • Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory

        containsBeanDefinition, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation
      • Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory

        containsLocalBean, getParentBeanFactory
      • Methods inherited from interface org.springframework.beans.factory.BeanFactory

        containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch
      • Methods inherited from interface org.springframework.context.MessageSource

        getMessage, getMessage, getMessage
      • Methods inherited from interface org.springframework.context.ApplicationEventPublisher

        publishEvent, publishEvent
      • Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver

        getResources
      • Methods inherited from interface org.springframework.core.io.ResourceLoader

        getClassLoader, getResource
      • Methods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistry

        containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames
      • Methods inherited from interface org.springframework.core.AliasRegistry

        getAliases
    • Field Detail

      • DISPATCHER_SERVLET_NAME

        public static final java.lang.String DISPATCHER_SERVLET_NAME
        Constant value for the DispatcherServlet bean name. A Servlet bean with this name is deemed to be the "main" servlet and is automatically given a mapping of "/" by default. To change the default behavior you can use a ServletRegistrationBean or a different bean name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ServletWebServerApplicationContext

        public ServletWebServerApplicationContext(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
        Create a new ServletWebServerApplicationContext with the given DefaultListableBeanFactory.
        Parameters:
        beanFactory - the DefaultListableBeanFactory instance to use for this context
    • Method Detail

      • postProcessBeanFactory

        protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
        Register ServletContextAwareProcessor.
        Overrides:
        postProcessBeanFactory in class org.springframework.web.context.support.GenericWebApplicationContext
        See Also:
        ServletContextAwareProcessor
      • refresh

        public final void refresh()
                           throws org.springframework.beans.BeansException,
                                  java.lang.IllegalStateException
        Specified by:
        refresh in interface org.springframework.context.ConfigurableApplicationContext
        Overrides:
        refresh in class org.springframework.context.support.AbstractApplicationContext
        Throws:
        org.springframework.beans.BeansException
        java.lang.IllegalStateException
      • onRefresh

        protected void onRefresh()
        Overrides:
        onRefresh in class org.springframework.web.context.support.GenericWebApplicationContext
      • doClose

        protected void doClose()
        Overrides:
        doClose in class org.springframework.context.support.AbstractApplicationContext
      • getServletContextInitializerBeans

        protected java.util.Collection<ServletContextInitializer> getServletContextInitializerBeans()
        Returns 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.
        Returns:
        the servlet initializer beans
      • prepareWebApplicationContext

        protected void prepareWebApplicationContext(javax.servlet.ServletContext servletContext)
        Prepare the 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.
        Parameters:
        servletContext - the operational servlet context
      • getResourceByPath

        protected org.springframework.core.io.Resource getResourceByPath(java.lang.String path)
        Overrides:
        getResourceByPath in class org.springframework.web.context.support.GenericWebApplicationContext
      • getServerNamespace

        public java.lang.String getServerNamespace()
        Description copied from interface: WebServerApplicationContext
        Returns the namespace of the web server application context or null 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).
        Specified by:
        getServerNamespace in interface WebServerApplicationContext
        Returns:
        the server namespace
      • setServletConfig

        public void setServletConfig(javax.servlet.ServletConfig servletConfig)
        Specified by:
        setServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext
        Overrides:
        setServletConfig in class org.springframework.web.context.support.GenericWebApplicationContext
      • getServletConfig

        public javax.servlet.ServletConfig getServletConfig()
        Specified by:
        getServletConfig in interface org.springframework.web.context.ConfigurableWebApplicationContext
        Overrides:
        getServletConfig in class org.springframework.web.context.support.GenericWebApplicationContext