Spring / Spring MVC Interview questions
Spring MVC Framework: What is ContextLoaderListener?
ContextLoaderListener reads the spring configuration file specified using 'contextConfigLocation' in web.xml, parses it and loads the beans defined in that config file to the ApplicationContext.
<servlet> <servlet-name>springMVC</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
The ContextLoaderListener has purposes like,
binding the lifecycle of the ApplicationContext with that of lifecycle of the ServletContext.
creates the ApplicationContext and WebApplicationContext.
More Related questions...