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 projec开发者_如何学Pythont is a web application that uses the first project. I need to declare beans in the web application that use the services beans (the java project).
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"/>
You can use maven. Packge first project as jar and add its dependency in second project's pom.xml. You will be able to reference all the beans defined in first project.
精彩评论