Monday, June 23, 2008

Configuring Spring for your Web App

Configuring Spring is pretty easy.

Add a listener:-

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

The ContextLoaderListener implements ServletContextListener.

You can also configure the xml which Spring should read:-

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/context/applicationContext-*.xml</param-value>
<!--
The following param-value should be used instead if we ever want to search for context files anywhere in the classpath
<param-value>/WEB-INF/classes/context/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
-->
</context-param>

Hope it helps,
Thanks.

No comments: