PDA

View Full Version : Context heirarchies within a webapp


mperham
Aug 26th, 2004, 12:19 PM
We have our application broken into three layers:

domain (database beans)
common (services)
webapp (tapestry components and pages)

each of which is a maven project. I'd like to be able to have each layer bundle an applicationContext-<name>.xml within its own jar so that the wiring is automatically picked up. So within domain.jar, you would have an applicationContext-domain.xml, etc. Finally you would have an applicationContext-webapp.xml in WEB-INF/classes. According to the docs, I can specify the various applicationContexts to use in the web.xml but they must be files. Is there a way to use the classpath instead?

Rod Johnson
Aug 26th, 2004, 12:33 PM
Is there a way to use the classpath instead?
Yes, you can use Spring's resource location abstraction. Simply use locations of the form classpath:com/mycompany/mypackage/test-datasource.xml