diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java index 0a2e8d0aa3..764201337d 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,9 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo protected AnnotationAttributes enableTx; + /** + * Default transaction manager. + */ protected PlatformTransactionManager txManager; diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java index 62bbe0ee15..21c3ad4cc5 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ import org.springframework.transaction.PlatformTransactionManager; /** * Interface to be implemented by @{@link org.springframework.context.annotation.Configuration - * Configuration} classes annotated with @{@link EnableTransactionManagement} that wish - * or need to specify explicitly the {@link PlatformTransactionManager} bean to be used + * Configuration} classes annotated with @{@link EnableTransactionManagement} that wish to + * or need to explicitly specify the default {@link PlatformTransactionManager} bean to be used * for annotation-driven transaction management, as opposed to the default approach of a * by-type lookup. One reason this might be necessary is if there are two * {@code PlatformTransactionManager} beans present in the container. @@ -42,7 +42,7 @@ import org.springframework.transaction.PlatformTransactionManager; public interface TransactionManagementConfigurer { /** - * Return the transaction manager bean to use for annotation-driven database + * Return the default transaction manager bean to use for annotation-driven database * transaction management, i.e. when processing {@code @Transactional} methods. * *

There are two basic approaches to implementing this method: diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java index fdf16411b6..fa12fef441 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java @@ -58,6 +58,8 @@ import org.springframework.util.StringUtils; * * @author Rod Johnson * @author Juergen Hoeller + * @author Stéphane Nicoll + * @author Sam Brannen * @since 1.1 * @see #setTransactionManager * @see #setTransactionAttributes @@ -120,8 +122,14 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init protected final Log logger = LogFactory.getLog(getClass()); + /** + * Default transaction manager bean name. + */ private String transactionManagerBeanName; + /** + * Default transaction manager. + */ private PlatformTransactionManager transactionManager; private TransactionAttributeSource transactionAttributeSource; @@ -144,14 +152,18 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init } /** - * Specify the target transaction manager. + * Specify the default transaction manager to use to drive transactions. + *

The default transaction manager will be used if a qualifier + * has not been declared for a given transaction or if an explicit name for the + * default transaction manager bean has not been specified. + * @see #setTransactionManagerBeanName */ public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } /** - * Return the transaction manager, if specified. + * Return the default transaction manager, or {@code null} if unknown. */ public PlatformTransactionManager getTransactionManager() { return this.transactionManager; @@ -351,7 +363,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init return txManager; } else { - // Lookup the default transaction manager and store it for next call + // Look up the default transaction manager and cache it for subsequent calls this.transactionManager = this.beanFactory.getBean(PlatformTransactionManager.class); return this.transactionManager; } diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java index 27a7593046..f24fa8f05d 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements /** * Create a new TransactionInterceptor. - * @param ptm the transaction manager to perform the actual transaction management + * @param ptm the default transaction manager to perform the actual transaction management * @param attributes the transaction attributes in properties format * @see #setTransactionManager * @see #setTransactionAttributes(java.util.Properties) @@ -74,7 +74,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements /** * Create a new TransactionInterceptor. - * @param ptm the transaction manager to perform the actual transaction management + * @param ptm the default transaction manager to perform the actual transaction management * @param tas the attribute source to be used to find transaction attributes * @see #setTransactionManager * @see #setTransactionAttributeSource(TransactionAttributeSource) diff --git a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java index bb14fb0525..c86d3bacd2 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java +++ b/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java @@ -120,7 +120,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe /** - * Set the transaction manager. This will perform actual + * Set the default transaction manager. This will perform actual * transaction management: This class is just a way of invoking it. * @see TransactionInterceptor#setTransactionManager */