Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Supporting multiple transaction attribute sources [SPR-1735] #6432
The BeanNameAutoProxyCreator supports a single transaction attribute source. I just came across a scenario wherein our project would find it easier if multiple transaction attribute sources are supported. This way we can have generic definitions for get*, set* etc in a NameMatchTxSource and then override when there is a need using a MethodMapTxSource.
I was not able to find this functionality. If it is not available already then instead of modifying the BeanNameAutoProxyCreator, i think it would be easier to add a TransactionAttributeSource implementation that maintains a list of references to other transaction attribute sources defined in the spring config file. This impl when requested for a transaction attribute def could then consult each of these references in the list's default order and return the first non null transaction attribute definition it gets.
A simple implementation is pasted below.
public class TransactionAttributeSourceList implements
No further details from SPR-1735
Juergen Hoeller commented
Thanks for the suggestion! I've added a CompositeTransactionAttributeSource for programmatic use, and a "setTransactionAttributeSources(TransactionAttributeSource)" method to TransactionAspectSupport (inherited by TransactionInterceptor).