I am studying Spring framework, in web.xml I added following which is a bootstrap listener. Can anyone give me a proper idea of what is a bootstrap listener?


You can see the doc here: ContextLoadListener

Bootstrap listener to start up and shut down Spring's root WebApplicationContext. Simply delegates to ContextLoader as well as to ContextCleanupListener.

This listener should be registered after Log4jConfigListener in web.xml, if the latter is used.

As of Spring 3.1, ContextLoaderListener supports injecting the root web application context via the ContextLoaderListener(WebApplicationContext) constructor, allowing for programmatic configuration in Servlet 3.0+ environments. See WebApplicationInitializer for usage examples...

1 Answer 1


It's an event listener as defined in the servlet standard. Basically, it's a way to execute code when the servlet container has started the web app.

Spring's ContextLoaderListener uses this mechanism to create the WebApplicationContext, which involves reading and parsing all bean configuration XML files, as well as (depending on the configuration) instantiating the singleton beans.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.