I have a web application in context A needs access to some APIs provided by a web application in context B. I'm going to create a set of interfaces to define the APIs that application A can access.

This library of interfaces will also include factories. My current idea is the factories have a utlity that will do a lookup via JNDI for a BeanFactory and then the factories will use the BeanFactory to create instances of the interfaces. The BeanFactory would be configured and implementations of the interfaces provided by the application in context B.

This will keep any spring code out of the application in context A that depend only on the factories and interfaces API and allow for the actual application in context B to be swapped out more easily.

I looked at using the JndiBeanFactoryLocator for the factories to find the bean factory but I don't know how to setup a bean factory to be accesable via jndi. Any pointers will be much appreciated.

-Eric Dalquist