Monday, August 27, 2012

What is ContextLoaderListener in Spring?

After a very long time, started refresh myself on spring framework, started with some sample web application got held up on the configuration ContextLoaderListener, what it really is, what was the use.
It is the Bootstrap listner to start up the Spring's root WebApplicationContext. All configuration which have been configured and loaded up during the startup, will be available throughout the application.

Mostly DB Configuration will be most one which can be seen
To register the listner, just add the below line to the web.xml
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
The class ContextLoaderListner will be found in the spring.jar, which can be found in the dist folder under spring bundle.

Happy Programming !!

No comments:

Post a Comment