ServletWebServerApplicationContext

A 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.

Author

Phillip Webb

Dave Syer

Scott Frederick

Since

2.0.0

See also

Inheritors

Constructors

Link copied to clipboard
constructor()
constructor(beanFactory: DefaultListableBeanFactory)
Create a new ServletWebServerApplicationContext with the given DefaultListableBeanFactory.

Types

Link copied to clipboard
Utility class to store and restore any user defined scopes.

Properties

Link copied to clipboard
val APPLICATION_EVENT_MULTICASTER_BEAN_NAME: String = "applicationEventMulticaster"
Link copied to clipboard
val APPLICATION_STARTUP_BEAN_NAME: String = "applicationStartup"
Link copied to clipboard
Link copied to clipboard
val BOOTSTRAP_EXECUTOR_BEAN_NAME: String = "bootstrapExecutor"
Link copied to clipboard
Link copied to clipboard
val CLASSPATH_ALL_URL_PREFIX: String = "classpath*:"
Link copied to clipboard
val CLASSPATH_URL_PREFIX: String = "classpath:"
Link copied to clipboard
Link copied to clipboard
val CONTEXT_ATTRIBUTES_BEAN_NAME: String = "contextAttributes"
Link copied to clipboard
val CONTEXT_PARAMETERS_BEAN_NAME: String = "contextParameters"
Link copied to clipboard
val CONVERSION_SERVICE_BEAN_NAME: String = "conversionService"
Link copied to clipboard
val DISPATCHER_SERVLET_NAME: String = "dispatcherServlet"
Constant value for the DispatcherServlet bean name.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ENVIRONMENT_BEAN_NAME: String = "environment"
Link copied to clipboard
Link copied to clipboard
open var id: String
Link copied to clipboard
val LIFECYCLE_PROCESSOR_BEAN_NAME: String = "lifecycleProcessor"
Link copied to clipboard
val LOAD_TIME_WEAVER_BEAN_NAME: String = "loadTimeWeaver"
Link copied to clipboard
val MESSAGE_SOURCE_BEAN_NAME: String = "messageSource"
Link copied to clipboard
Link copied to clipboard
val SCOPE_APPLICATION: String = "application"
Link copied to clipboard
val SCOPE_REQUEST: String = "request"
Link copied to clipboard
val SCOPE_SESSION: String = "session"
Link copied to clipboard
Link copied to clipboard
val SERVLET_CONFIG_BEAN_NAME: String = "servletConfig"
Link copied to clipboard
val SERVLET_CONTEXT_BEAN_NAME: String = "servletContext"
Link copied to clipboard
open var servletConfig: ServletConfig
Link copied to clipboard
open var servletContext: ServletContext
Link copied to clipboard
val SHUTDOWN_HOOK_THREAD_NAME: String = "SpringContextShutdownHook"
Link copied to clipboard
open val startupDate: Long
Link copied to clipboard
val SYSTEM_ENVIRONMENT_BEAN_NAME: String = "systemEnvironment"
Link copied to clipboard
val SYSTEM_PROPERTIES_BEAN_NAME: String = "systemProperties"
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun close()
Link copied to clipboard
open fun containsBean(name: String): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun <A : Annotation?> findAllAnnotationsOnBean(beanName: String, annotationType: Class<A>, allowFactoryBeanInit: Boolean): Set<A>
Link copied to clipboard
open fun <A : Annotation?> findAnnotationOnBean(beanName: String, annotationType: Class<A>): A
Link copied to clipboard
open fun getAliases(name: String): Array<String>
Link copied to clipboard
Link copied to clipboard
open fun getBean(name: String): Any
open fun <T> getBean(name: String, requiredType: Class<T>): T
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getBeanNamesForAnnotation(annotationType: Class<out Annotation>): Array<String>
Link copied to clipboard
Link copied to clipboard
open fun <T> getBeanProvider(requiredType: Class<T>): ObjectProvider<T>
Link copied to clipboard
open fun <T> getBeansOfType(type: Class<T>): Map<String, T>
Link copied to clipboard
open fun getBeansWithAnnotation(annotationType: Class<out Annotation>): Map<String, Any>
Link copied to clipboard
Link copied to clipboard
abstract fun getEnvironment(): Environment
Link copied to clipboard
open fun getMessage(code: String, args: Array<Any>, defaultMessage: String, locale: Locale): String
Link copied to clipboard
open fun getNamespace(): String
Link copied to clipboard
Link copied to clipboard
open fun getResource(location: String): Resource
Link copied to clipboard
open fun <T> getResourceCache(valueType: Class<T>): Map<Resource, T>
Link copied to clipboard
open fun getResources(locationPattern: String): Array<Resource>
Link copied to clipboard
Returns the server namespace if the specified context is a WebServerApplicationContext.
Link copied to clipboard
open fun getServletConfig(): ServletConfig
Link copied to clipboard
open fun getTheme(themeName: String): Theme
Link copied to clipboard
open fun getType(name: String): Class<out Any>
Link copied to clipboard
open fun hasServerNamespace(context: ApplicationContext, serverNamespace: String): Boolean
Returns true if the specified context is a WebServerApplicationContext with a matching server namespace.
Link copied to clipboard
open fun isActive(): Boolean
Link copied to clipboard
open fun isAlias(beanName: String): Boolean
Link copied to clipboard
Link copied to clipboard
open fun isBeanNameInUse(beanName: String): Boolean
Link copied to clipboard
open fun isClosed(): Boolean
Link copied to clipboard
open fun isPrototype(name: String): Boolean
Link copied to clipboard
open fun isRunning(): Boolean
Link copied to clipboard
open fun isSingleton(name: String): Boolean
Link copied to clipboard
open fun isTypeMatch(name: String, typeToMatch: ResolvableType): Boolean
Link copied to clipboard
Link copied to clipboard
fun refresh()
Link copied to clipboard
open fun refreshForAotProcessing(runtimeHints: RuntimeHints)
Link copied to clipboard
open fun registerAlias(beanName: String, alias: String)
Link copied to clipboard
open fun <T> registerBean(beanClass: Class<T>, constructorArgs: Array<Any>)
Link copied to clipboard
open fun registerBeanDefinition(beanName: String, beanDefinition: BeanDefinition)
Link copied to clipboard
Link copied to clipboard
open fun removeAlias(alias: String)
Link copied to clipboard
Link copied to clipboard
open fun removeBeanDefinition(beanName: String)
Link copied to clipboard
open fun setAllowBeanDefinitionOverriding(allowBeanDefinitionOverriding: Boolean)
Link copied to clipboard
open fun setAllowCircularReferences(allowCircularReferences: Boolean)
Link copied to clipboard
open fun setConfigLocation(configLocation: String)
Link copied to clipboard
open fun setConfigLocations(configLocations: Array<String>)
Link copied to clipboard
open fun setNamespace(namespace: String)
Link copied to clipboard
open fun setResourceLoader(resourceLoader: ResourceLoader)
Link copied to clipboard
open fun setServletConfig(servletConfig: ServletConfig)
Link copied to clipboard
open fun start()
Link copied to clipboard
open fun stop()
Link copied to clipboard
open fun toString(): String