Dec 6th, 2007, 12:07 PM
Loading resources relative to appcontext resource
I'm trying to figure out a way of loading resources relative to the resource from which the appcontext itself is defined in.
For example, I have a webappcontext whose beans are defined in classpath:/x/y/beans.xml. One of the beans in that context wants to load a number of resources which are also in classpath:/x/y/, but it needs to do so without resorting to absolute resource locations.
So can a bean within a context be made aware of the resource in which it was itself defined, i.e. classpath:/x/y/beans.xml? It's not enough to injected with the AppContext instance, since that will just try and load resources from the ServletContext root.
Or am I barking up the wrong tree?