The ContextLoaderListener
is a listener that helps to bootstrap Spring MVC. As the name suggests, it loads and creates the ApplicationContext
, so you don't have to write explicit code to do create it.
The application context is where Spring bean leaves. For a web application, there is is a subclass called WebAppliationContext
.
The ContextLoaderListener
also ties the lifecycle of the ApplicationContext
to the lifecycle of the ServletContext
. You can get the ServletContext
from the WebApplicationContext
using the getServletContext()
method.