Hi Ajay,
In your web.xml, the following should allow you to keep the three separate configuration files:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- other web.xml elements -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/application-hibernate.xml /WEB-INF/service-layer.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- other web.xml elements -->
</web-app>
I don't know what you mean when you say "My problem is If i dont mention all the xml files to web layer then my action beans fail to load because it says service beans definiton not found". If your web beans (e.g. controllers) depend on service layer beans defined in a different context, you have to let Spring know somehow about those beans. The above XML does just that.
Check out the samples/JPetstore/war/WEB-INF/web.xml file (from the Spring distribution) as an example. That sample application also breaks the context files into three separate ones (web, service, and dao).
-Arthur Loder