类 ServletListenerRegistrationBean<T extends EventListener>
java.lang.Object
org.springframework.boot.web.servlet.RegistrationBean
org.springframework.boot.web.servlet.ServletListenerRegistrationBean<T>
- 类型参数:
T
- the type of listener
- 所有已实现的接口:
ServletContextInitializer
,Ordered
A
ServletContextInitializer
to register EventListener
s in a Servlet
3.0+ container. Similar to the registration
features provided by ServletContext
but with a Spring Bean
friendly design.
This bean can be used to register the following types of listener:
- 从以下版本开始:
- 1.4.0
- 作者:
- Dave Syer, Phillip Webb
-
字段概要
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
构造器概要
构造器构造器说明Create a newServletListenerRegistrationBean
instance.ServletListenerRegistrationBean
(T listener) Create a newServletListenerRegistrationBean
instance. -
方法概要
修饰符和类型方法说明protected String
Return a description of the registration.Return the listener to be registered.Return the supported types for this registration.static boolean
isSupportedType
(EventListener listener) Returnstrue
if the specified listener is one of the supported types.protected void
register
(String description, ServletContext servletContext) Register this bean with the servlet context.void
setListener
(T listener) Set the listener that will be registered.从类继承的方法 org.springframework.boot.web.servlet.RegistrationBean
getOrder, isEnabled, onStartup, setEnabled, setOrder
-
构造器详细资料
-
ServletListenerRegistrationBean
public ServletListenerRegistrationBean()Create a newServletListenerRegistrationBean
instance. -
ServletListenerRegistrationBean
Create a newServletListenerRegistrationBean
instance.- 参数:
listener
- the listener to register
-
-
方法详细资料
-
setListener
Set the listener that will be registered.- 参数:
listener
- the listener to register
-
getListener
Return the listener to be registered.- 返回:
- the listener to be registered
-
getDescription
从类复制的说明:RegistrationBean
Return a description of the registration. For example "Servlet resourceServlet"- 指定者:
getDescription
在类中RegistrationBean
- 返回:
- a description of the registration
-
register
从类复制的说明:RegistrationBean
Register this bean with the servlet context.- 指定者:
register
在类中RegistrationBean
- 参数:
description
- a description of the item being registeredservletContext
- the servlet context
-
isSupportedType
Returnstrue
if the specified listener is one of the supported types.- 参数:
listener
- the listener to test- 返回:
- if the listener is of a supported type
-
getSupportedTypes
Return the supported types for this registration.- 返回:
- the supported types
-