类 AbstractReactiveWebInitializer
- java.lang.Object
- org.springframework.web.server.adapter.AbstractReactiveWebInitializer
- 所有已实现的接口:
WebApplicationInitializer
public abstract class AbstractReactiveWebInitializer extends Object implements WebApplicationInitializer
Base class for aWebApplicationInitializer
that installs a Spring Reactive Web Application on a Servlet container.Spring configuration is loaded and given to
WebHttpHandlerBuilder
which scans the context looking for specific beans and creates a reactiveHttpHandler
. The resulting handler is installed as a Servlet through theServletHttpHandlerAdapter
.- 从以下版本开始:
- 5.0.2
- 作者:
- Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 static String
DEFAULT_SERVLET_NAME
The default servlet name to use.
构造器概要
构造器 构造器 说明 AbstractReactiveWebInitializer()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected ApplicationContext
createApplicationContext()
Return the Spring configuration that contains application beans including the ones detected byWebHttpHandlerBuilder.applicationContext
.protected abstract Class<?>[]
getConfigClasses()
Specify@Configuration
and/or@Component
classes that make up the application configuration.protected String
getServletMapping()
Return the Servlet mapping to use.protected String
getServletName()
Return the name to use to register theServletHttpHandlerAdapter
.void
onStartup(ServletContext servletContext)
Configure the givenServletContext
with any servlets, filters, listeners context-params and attributes necessary for initializing this web application.protected void
refreshApplicationContext(ApplicationContext context)
Refresh the given application context, if necessary.protected void
registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext)
Register aServletContextListener
that closes the given application context when the servlet context is destroyed.
字段详细资料
DEFAULT_SERVLET_NAME
public static final String DEFAULT_SERVLET_NAME
The default servlet name to use. SeegetServletName()
.- 另请参阅:
- 常量字段值
构造器详细资料
AbstractReactiveWebInitializer
public AbstractReactiveWebInitializer()
方法详细资料
onStartup
public void onStartup(ServletContext servletContext) throws ServletException
从接口复制的说明:WebApplicationInitializer
Configure the givenServletContext
with any servlets, filters, listeners context-params and attributes necessary for initializing this web application. See examples above.- 指定者:
onStartup
在接口中WebApplicationInitializer
- 参数:
servletContext
- theServletContext
to initialize- 抛出:
ServletException
- if any call against the givenServletContext
throws aServletException
getServletName
protected String getServletName()
Return the name to use to register theServletHttpHandlerAdapter
.By default this is
DEFAULT_SERVLET_NAME
.
createApplicationContext
protected ApplicationContext createApplicationContext()
Return the Spring configuration that contains application beans including the ones detected byWebHttpHandlerBuilder.applicationContext
.
getConfigClasses
protected abstract Class<?>[] getConfigClasses()
Specify@Configuration
and/or@Component
classes that make up the application configuration. The config classes are given to createApplicationContext().
refreshApplicationContext
protected void refreshApplicationContext(ApplicationContext context)
Refresh the given application context, if necessary.
registerCloseListener
protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext)
Register aServletContextListener
that closes the given application context when the servlet context is destroyed.- 参数:
servletContext
- the servlet context to listen toapplicationContext
- the application context that is to be closed whenservletContext
is destroyed
getServletMapping
protected String getServletMapping()
Return the Servlet mapping to use. Only the default Servlet mapping '/' and path-based Servlet mappings such as '/api/*' are supported.By default this is set to '/'.