• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Spring by
Q:
What is ContextLoaderListener and what does it do

1 Answer

0 votes
by

The ContextLoaderListener loads and creates the ApplicationContext, so a developer need not write explicit code to do create it. In short, it is a listener that aids to bootstrap Spring MVC.

The application context is where Spring bean resides. For a web application, there is a subclass called WebAppliationContext.

The lifecycle of the ApplicationContext is tied to the lifecycle of the ServletContext by using ContextLoaderListener. The ServletContext from the WebApplicationContext can be obtained using the getServletContext() method.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Apr 4, 2021 in Spring by Robindeniel
...