views:

23

answers:

1

Hello;

I'm a novice on spring, i started to develop a new application with 2 modules, each one is a project, the first one is a java project, it contains the services beans declared in a servicescontext.xml, the second prpject is a web application that use the first project. I need to declare beans in the web application that use the services beans(the java project).

Thank you

+2  A: 

I guess this sort of depends on how you want to package the webapp. One solution that can work for you is to package the service-module as a jar file and then put it in the WEB-INF/lib of your webapp. You can then reference the other xml-file(s) from your webapp configuration. Take a look at this:

<import resource="servicescontext.xml"/>

Add "classpath" to reference the xml-file in the service-module jar file:

<import resource="classpath:servicescontext.xml"/>
Jarle Hansen
thank you for your answer, but it doesn't work, i developped a simple application with spring with a simple bean(add), and a generated the jar, in the web application i addes the jar to the lib, and i tried to import the bean add, but, it doesn't work;If any one has a solution thank you