I have the following scenario:
1) two xml configuration files, say foo.xml and bar.xml. They contain ClassPathXmlApplicationContext beans with names fooFactory and barFactory resp. Each bean in turn is given its own xml configuration file through its constructor,
2) client code usesSingletonBeanFactoryLocator and methods getInstance and useBean to get these factories. E.g. SingletonBeanFactoryLocator.getInstance("classpath:foo.xml").useBeanFactory("fooFactory");
Requirement: some beans in barFactory need to access some beans in fooFactory.
The current solution is to get a reference to fooFactory through SingletonBeanFactoryLocator.getInstance("classpath:foo.xml").useBeanFactory("fooFactory"); and the use getBean to get the necessary beans.
Question: is it possible to inject beans from fooFactory into beans from barFactory, so beans in barFactory get these dependencies automatically?
I ended up defining these factories in the same .xml and chaining them. I then did normal injection of fooFactory beans into barFactory beans.