类 AbstractReactiveWebInitializer
- java.lang.Object
- org.springframework.web.server.adapter.AbstractReactiveWebInitializer
- 所有已实现的接口:
WebApplicationInitializer
public abstract class AbstractReactiveWebInitializer extends Object implements WebApplicationInitializer
Base class for aWebApplicationInitializerthat installs a Spring Reactive Web Application on a Servlet container.Spring configuration is loaded and given to
WebHttpHandlerBuilderwhich 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 StringDEFAULT_SERVLET_NAMEThe default servlet name to use.
构造器概要
构造器 构造器 说明 AbstractReactiveWebInitializer()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected ApplicationContextcreateApplicationContext()Return the Spring configuration that contains application beans including the ones detected byWebHttpHandlerBuilder.applicationContext.protected abstract Class<?>[]getConfigClasses()Specify@Configurationand/or@Componentclasses that make up the application configuration.protected StringgetServletMapping()Return the Servlet mapping to use.protected StringgetServletName()Return the name to use to register theServletHttpHandlerAdapter.voidonStartup(ServletContext servletContext)Configure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initializing this web application.protected voidrefreshApplicationContext(ApplicationContext context)Refresh the given application context, if necessary.protected voidregisterCloseListener(ServletContext servletContext, ApplicationContext applicationContext)Register aServletContextListenerthat 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
从接口复制的说明:WebApplicationInitializerConfigure the givenServletContextwith any servlets, filters, listeners context-params and attributes necessary for initializing this web application. See examples above.- 指定者:
onStartup在接口中WebApplicationInitializer- 参数:
servletContext- theServletContextto initialize- 抛出:
ServletException- if any call against the givenServletContextthrows 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@Configurationand/or@Componentclasses 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 aServletContextListenerthat 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 whenservletContextis 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 '/'.