@ -349,15 +349,22 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
* Determine the specific transaction manager to use for the given transaction .
* /
protected PlatformTransactionManager determineTransactionManager ( TransactionAttribute txAttr ) {
if ( this . beanFactory ! = null ) {
String qualifier = txAttr ! = null ? txAttr . getQualifier ( ) : null ;
// Do not attempt to lookup tx manager if no tx attributes are set
if ( txAttr = = null | | this . beanFactory = = null ) {
return getTransactionManager ( ) ;
}
String qualifier = ( txAttr . getQualifier ( ) ! = null ?
txAttr . getQualifier ( ) : this . transactionManagerBeanName ) ;
if ( StringUtils . hasText ( qualifier ) ) {
return determineQualifiedTransactionManager ( qualifier ) ;
PlatformTransactionManager txManager = this . transactionManagerCache . get ( qualifier ) ;
if ( txManager = = null ) {
txManager = BeanFactoryAnnotationUtils . qualifiedBeanOfType (
this . beanFactory , PlatformTransactionManager . class , qualifier ) ;
this . transactionManagerCache . putIfAbsent ( qualifier , txManager ) ;
}
else if ( StringUtils . hasText ( this . transactionManagerBeanName ) ) {
return determineQualifiedTransactionManager ( this . transactionManagerBeanName ) ;
return txManager ;
}
else if ( txAttr ! = null ) { // Do not lookup default bean name if no tx attributes are set
else {
PlatformTransactionManager defaultTransactionManager = getTransactionManager ( ) ;
if ( defaultTransactionManager = = null ) {
defaultTransactionManager = this . beanFactory . getBean ( PlatformTransactionManager . class ) ;
@ -367,18 +374,6 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
return defaultTransactionManager ;
}
}
return getTransactionManager ( ) ;
}
private PlatformTransactionManager determineQualifiedTransactionManager ( String qualifier ) {
PlatformTransactionManager txManager = this . transactionManagerCache . get ( qualifier ) ;
if ( txManager = = null ) {
txManager = BeanFactoryAnnotationUtils . qualifiedBeanOfType (
this . beanFactory , PlatformTransactionManager . class , qualifier ) ;
this . transactionManagerCache . putIfAbsent ( qualifier , txManager ) ;
}
return txManager ;
}
/ * *
* Convenience method to return a String representation of this Method