I would like to supply a dynamic list of TransactionInterceptors to the BeanNameAutoProxyCreator. The reason I’d like to do this is that the application I’m working on accesses a dynamic list of databases that is known only at run time, not at compile time. The databases do not need to participate in distributed transactions. The application functions like some of the tools in the IBM Rational suite: the user chooses which database she would like to use when logging in.
I would like to apply declarative transaction management to each of the databases the system administrator has defined by performing the following actions whenever the application context is loaded or reloaded:
1) Detect the DataSources defined in the application context
2) Create TransactionManagers and TransactionInterceptors for each DataSource and
3) Supply the databases to the BeanNameAutoProxyCreator.
Now for my question: is this a good approach or should I try something different? One problem with my approach is that there doesn’t seem to be a way to supply a dynamic list of interceptors to the BeanNameAutoProxyCreator. In order to do this, the AbstractAutoProxyCreator.resolveInterceptorNames would need to be a protected method rather than a private, as it is currently defined. If this is the only way, I’d be happy to supply a patch.
Thanks in advance for your help!
Matt
PS - has anyone ever considered a WriteableApplicationContext interface that would allow for easy programmatic changes of the application context at runtime?


Reply With Quote
With a WriteableBeanFactory I meant a bean factory that knew how to take its runtime contents and serialize that to an XML file.