I'm trying something in the lines of having a Factory class return a Prototype of multiple types.
I have a Factory class as follows:
In the above getXXXPersistence() methods, I would like to have Spring give my objects as I have some injections happening in those implementations. For the very same purpose, I have looked up the Spring docs and came across the look up method injection. But the problem here is that to use the method injection (without having any dependencies on Spring, using the CGLIB proxy), I must declare the above Factory class as abstract as required by the CGLIB proxy. If that be the case, then it violates one principle that I want to maintain which is that the Factory class above will not retain its static methods and the class will not be final. Is there a way to overcome this?
In essence I want Spring to inject a Prototype bean (XXXPersistence) into the Singleton bean (MyXXXFactory). Any suggestions?