Monday, July 9, 2012

How to provide custom web context application file to Spring?

If you want to name your web application context XML files differently or store them in a different
location, you can do so by using the Dispatcher-Portlet’s contextConfigLocation initialization parameter, as shown here:


<portlet>
<portlet-name>helloWorld</portlet-name>
<portlet-class>
org.springframework.web.portlet.DispatcherPortlet
</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/context/portlet/myContext.xml</value>
</init-param>

...
</portlet>
You can also specify multiple locations for the web application context XML files as
comma-separated values in the contextConfigLocation parameter.

No comments:

Post a Comment