I would like to send a runtime argument to a prototype bean. This appears to be in the box for the XMLBeanFactory class, having a getBean(String, Object args) method, but that method does not exist for an ApplicationContext.
The reason is that I'm needing to create Hibernate SessionFactories at runtime and bind them to a schema that is only known at runtime. So, I would like to have my own implementation of LocalSessionFactoryBean that would essentially function the same, but instead create prototype SessionFactories that are bound to the appropriate schema, that is not known until runtime. Basically, this is to support the fact that we have multiple identical schemas, one for each of our customers, and my DAOs will accept the customer ID as a parameter, at which point they will request the appropriate SessionFactory, which will probalby be stored in a map keyed by customer ID, or created and bound to the appropriate schema if they're not in the map yet.
I've been bouncing this around for a few days, and just can't think of a clean "Spring-erific" way to do it. I could always just make local method calls, bypassing the framework, but then I would have the ability to add interceptors to the intermediate objects.
Any advice would be much appreciated.