org.springframework.web.context

Class ContextCleanupListener

  • java.lang.Object
    • org.springframework.web.context.ContextCleanupListener
  • All Implemented Interfaces:
    java.util.EventListener, ServletContextListener


    public class ContextCleanupListener
    extends java.lang.Object
    implements ServletContextListener
    Web application listener that cleans up remaining disposable attributes in the ServletContext, i.e. attributes which implement DisposableBean and haven't been removed before. This is typically used for destroying objects in "application" scope, for which the lifecycle implies destruction at the very end of the web application's shutdown phase.
    Since:
    3.0
    Author:
    Juergen Hoeller
    See Also:
    ServletContextScope, ContextLoaderListener
    • Constructor Detail

      • ContextCleanupListener

        public ContextCleanupListener()
    • Method Detail

      • contextInitialized

        public void contextInitialized(ServletContextEvent event)
        Description copied from interface: javax.servlet.ServletContextListener
        Receives notification that the web application initialization process is starting.

        All ServletContextListeners are notified of context initialization before any filters or servlets in the web application are initialized.

        Specified by:
        contextInitialized in interface ServletContextListener
        Parameters:
        event - the ServletContextEvent containing the ServletContext that is being initialized
      • contextDestroyed

        public void contextDestroyed(ServletContextEvent event)
        Description copied from interface: javax.servlet.ServletContextListener
        Receives notification that the ServletContext is about to be shut down.

        All servlets and filters will have been destroyed before any ServletContextListeners are notified of context destruction.

        Specified by:
        contextDestroyed in interface ServletContextListener
        Parameters:
        event - the ServletContextEvent containing the ServletContext that is being destroyed