Since no one answered, I just went with my approach and seemed to work, albeit with a slight modification, to allow the bean to properly destroy the internal context.
In your jar utility, create a class that loads the application xml context like this:
public class Services implements DisposableBean { ClassPathXmlApplicationContext ctx; private MyAService myAService; private MyBService myBService; public Services() { this.ctx = new ClassPathXmlApplicationContext("services-context.xml");
Make sure your "services-context.xml" file is unique in the classpath. You can do this by placing it in a folder structure that matches the package structure.
In your other bank / war, create beaning using something like:
<bean id="services" class="Services" destroy-method="destroy"/>
Or, if your other jar / war does not use spring, you do something like:
Services s = new Services(); //... use your services, then clean up when done s.myAService.doSomething(); s.destroy();
niltz source share