Sunday, August 19, 2012

what is the default file loaded by ContextLoaderListener?

When we want to keep our beans definitions in multiple files we can use ContextLoaderListener.

This Context loader listener reads one context parameter where we specify list of files : contextConfigLocation

By default this listener  look for a Spring configuration file at /WEB-INF/applicationContext.
xml


To specify multiple files

<listener>
<listener-class>org.springframework.
web.context.ContextLoaderListener</listener-class>
</listener>


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/ourapp-service.xml
/WEB-INF/ourapp-data.xml
/WEB-INF/ourapp-security.xml
</param-value>
</context-param>


The contextConfigLocation parameter is specified as a list of paths (relative to
the web application root)

No comments:

Post a Comment