diff --git a/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java b/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java index bbe27688e2e..abb75ef452d 100644 --- a/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java +++ b/org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java @@ -43,28 +43,24 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** - * Base class for transactional aspects, such as the AOP Alliance - * {@link TransactionInterceptor} or an AspectJ aspect. + * Base class for transactional aspects, such as the {@link TransactionInterceptor} + * or an AspectJ aspect. * - *
This enables the underlying Spring transaction infrastructure to be used - * easily to implement an aspect for any aspect system. + *
This enables the underlying Spring transaction infrastructure to be used easily + * to implement an aspect for any aspect system. * - *
Subclasses are responsible for calling methods in this class in the - * correct order. + *
Subclasses are responsible for calling methods in this class in the correct order. * - *
If no transaction name has been specified in the
- * TransactionAttribute, the exposed name will be the
- * fully-qualified class name + "." + method name
+ *
If no transaction name has been specified in the TransactionAttribute,
+ * the exposed name will be the fully-qualified class name + "." + method name
* (by default).
*
- *
Uses the Strategy design pattern. A
- * PlatformTransactionManager implementation will perform the
- * actual transaction management, and a TransactionAttributeSource
- * is used for determining transaction definitions.
+ *
Uses the Strategy design pattern. A PlatformTransactionManager
+ * implementation will perform the actual transaction management, and a
+ * TransactionAttributeSource is used for determining transaction definitions.
*
- *
A transaction aspect is serializable if it's
- * PlatformTransactionManager and
- * TransactionAttributeSource are serializable.
+ *
A transaction aspect is serializable if its PlatformTransactionManager
+ * and TransactionAttributeSource are serializable.
*
* @author Rod Johnson
* @author Juergen Hoeller
@@ -234,7 +230,7 @@ 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.transactionManager != null) {
+ if (this.transactionManager != null || this.beanFactory == null) {
return this.transactionManager;
}
PlatformTransactionManager chosen = null;