Interface WebServerApplicationContext
- All Superinterfaces:
ApplicationContext
,ApplicationEventPublisher
,BeanFactory
,EnvironmentCapable
,HierarchicalBeanFactory
,ListableBeanFactory
,MessageSource
,ResourceLoader
,ResourcePatternResolver
- All Known Subinterfaces:
ConfigurableWebServerApplicationContext
- All Known Implementing Classes:
AnnotationConfigReactiveWebServerApplicationContext
,AnnotationConfigServletWebServerApplicationContext
,ReactiveWebServerApplicationContext
,ServletWebServerApplicationContext
,XmlServletWebServerApplicationContext
Interface to be implemented by
application contexts
that
create and manage the lifecycle of an embedded WebServer
.- Since:
- 2.0.0
- Author:
- Phillip Webb
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
SmartLifecycle phase
in which graceful shutdown of the web server is performed.static final int
SmartLifecycle phase
in which starting and stopping of the web server is performed.Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHAR
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX
-
Method Summary
Modifier and TypeMethodDescriptionReturns the namespace of the web server application context ornull
if no namespace has been set.static String
getServerNamespace
(ApplicationContext context) Returns the server namespace if the specified context is aWebServerApplicationContext
.Returns theWebServer
that was created by the context ornull
if the server has not yet been created.static boolean
hasServerNamespace
(ApplicationContext context, String serverNamespace) Returnstrue
if the specified context is aWebServerApplicationContext
with a matching server namespace.Methods inherited from interface org.springframework.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate
Methods inherited from interface org.springframework.context.ApplicationEventPublisher
publishEvent, publishEvent
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.core.env.EnvironmentCapable
getEnvironment
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
Methods inherited from interface org.springframework.core.io.ResourceLoader
getClassLoader, getResource
Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResources
-
Field Details
-
GRACEFUL_SHUTDOWN_PHASE
static final int GRACEFUL_SHUTDOWN_PHASESmartLifecycle phase
in which graceful shutdown of the web server is performed.- Since:
- 4.0.0
- See Also:
-
START_STOP_LIFECYCLE_PHASE
static final int START_STOP_LIFECYCLE_PHASESmartLifecycle phase
in which starting and stopping of the web server is performed.- Since:
- 4.0.0
- See Also:
-
-
Method Details
-
getWebServer
-
getServerNamespace
String getServerNamespace()Returns the namespace of the web server application context ornull
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).- Returns:
- the server namespace
-
hasServerNamespace
Returnstrue
if the specified context is aWebServerApplicationContext
with a matching server namespace.- Parameters:
context
- the context to checkserverNamespace
- the server namespace to match against- Returns:
true
if the server namespace of the context matches- Since:
- 2.1.8
-
getServerNamespace
Returns the server namespace if the specified context is aWebServerApplicationContext
.- Parameters:
context
- the context- Returns:
- the server namespace or
null
if the context is not aWebServerApplicationContext
- Since:
- 2.6.0
-