类 ServletListenerRegistrationBean<T extends EventListener>

  • 类型参数:
    T - the type of listener
    所有已实现的接口:
    ServletContextInitializer, org.springframework.core.Ordered

    public class ServletListenerRegistrationBean<T extends EventListener>
    extends RegistrationBean
    A ServletContextInitializer to register EventListeners 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:
    • ServletContextAttributeListener
    • ServletRequestListener
    • ServletRequestAttributeListener
    • HttpSessionAttributeListener
    • HttpSessionListener
    • ServletContextListener
    从以下版本开始:
    1.4.0
    • 方法详细资料

      • setListener

        public void setListener​(T listener)
        Set the listener that will be registered.
        参数:
        listener - the listener to register
      • onStartup

        public void onStartup​(javax.servlet.ServletContext servletContext)
                       throws javax.servlet.ServletException
        从接口复制的说明: ServletContextInitializer
        Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
        参数:
        servletContext - the ServletContext to initialize
        抛出:
        javax.servlet.ServletException - if any call against the given ServletContext throws a ServletException
      • isSupportedType

        public static boolean isSupportedType​(EventListener listener)
        Returns true if the specified listener is one of the supported types.
        参数:
        listener - the listener to test
        返回:
        if the listener is of a supported type
      • getSupportedTypes

        public static Set<Class<?>> getSupportedTypes()
        Return the supported types for this registration.
        返回:
        the supported types