Spring - How to load new hierarchical context?
Spring's ContextLoaderListener and ContextLoader classes perform the task of initializing the webapp application context, and it is also optional to bind another application context to the parent.
In particular, the loadParentContext () method uses the ContextSingletonbeanFactoryLocator by default to try to find the parent context of the webapp, but if that doesn't fit, you can subclass the ContextLoader (and ContextLoaderListener) to programmatically find your apptext libraries.
source to share
Looks like I figured out how to do this .. (thanks to " skaffman " for the help)
In web.xml, define the param context locatorFactorySelector
and set its value to the parent context of the beans.xml file. By default, the search is performed for the file pathpath *: beanRefContext.xml.
Here it is!
Now I need to see how to get my JUnits to load the parent context. Should be simple - just putting the file beanRefContext.xml
in the same directory, but looking.
source to share