Spring Framework

Spring Projects

Spring Project 1

Introduction of ContextLoaderListener
Previous Home Next

The spring MVC provide the facility to load the all configuration file information written in the applicationContext through the ContextLoderListener class. This class store in org.springframework. web.servlet package which are configure in the web.xml file to provide the actual information of spring configuration if you are not configure ContextLoaderListener class in the web.xml than default path are /WEB-INF/applicationContext.xml

You can specify one or more spring configuration files for the context loader to load by setting the "contextConfigLocation" parameter in the servlet context.

 

Example

<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
/WEB-INF/dispatcher-servlet.xml
/WEB-INF/data-servlet.xml
/WEB-INF/info-servlet.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Previous Home Next