Class ContextLoaderListener

java.lang.Object
org.springframework.web.context.ContextLoader
org.springframework.web.context.ContextLoaderListener
All Implemented Interfaces:
jakarta.servlet.ServletContextListener, EventListener

public class ContextLoaderListener extends ContextLoader implements jakarta.servlet.ServletContextListener
Bootstrap listener to start up and shut down Spring's root WebApplicationContext. Simply delegates to ContextLoader as well as to ContextCleanupListener.

ContextLoaderListener supports injecting the root web application context via the ContextLoaderListener(WebApplicationContext) constructor, allowing for programmatic configuration in Servlet initializers. See WebApplicationInitializer for usage examples.

Since:
17.02.2003
Author:
Juergen Hoeller, Chris Beams
See Also:
  • Constructor Details

  • Method Details

    • contextInitialized

      public void contextInitialized(jakarta.servlet.ServletContextEvent event)
      Initialize the root web application context.
      Specified by:
      contextInitialized in interface jakarta.servlet.ServletContextListener
    • contextDestroyed

      public void contextDestroyed(jakarta.servlet.ServletContextEvent event)
      Close the root web application context.
      Specified by:
      contextDestroyed in interface jakarta.servlet.ServletContextListener