I have googled it but not found satisfactory answer, it would be great if you guys can explain the difference between ContextLoaderListener
and RequestContextListener
.
contextloaderlistener :- Bootstrap listener to start up Spring's root WebApplicationContext. Simply delegates to ContextLoader.
requestcontextlistener :- This listener is mainly for use with third-party servlets, e.g. the JSF FacesServlet. Within Spring's own web support, DispatcherServlet's processing is perfectly sufficient.
If you use a Servlet 2.5 web container, with requests processed outside of Spring’s DispatcherServlet (for example, when using JSF or Struts), you need to register the org.springframework.web.context.request.RequestContextListener ServletRequestListener. For Servlet 3.0+, this can be done programmatically via the WebApplicationInitializer interface. Alternatively, or for older containers, add the following declaration to your web application’s web.xml file:
<listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> </web-app>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With