Skip to content

Commit 5b5cf37

Browse files
committed
Polish Javadoc regarding default transaction manager
1 parent eef0bf4 commit 5b5cf37

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,6 +40,9 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
4040

4141
protected AnnotationAttributes enableTx;
4242

43+
/**
44+
* Default transaction manager.
45+
*/
4346
protected PlatformTransactionManager txManager;
4447

4548

spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@
2020

2121
/**
2222
* Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
23-
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish
24-
* or need to specify explicitly the {@link PlatformTransactionManager} bean to be used
23+
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish to
24+
* or need to explicitly specify the default {@link PlatformTransactionManager} bean to be used
2525
* for annotation-driven transaction management, as opposed to the default approach of a
2626
* by-type lookup. One reason this might be necessary is if there are two
2727
* {@code PlatformTransactionManager} beans present in the container.
@@ -42,7 +42,7 @@
4242
public interface TransactionManagementConfigurer {
4343

4444
/**
45-
* Return the transaction manager bean to use for annotation-driven database
45+
* Return the default transaction manager bean to use for annotation-driven database
4646
* transaction management, i.e. when processing {@code @Transactional} methods.
4747
*
4848
* <p>There are two basic approaches to implementing this method:

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
*
5959
* @author Rod Johnson
6060
* @author Juergen Hoeller
61+
* @author Stéphane Nicoll
62+
* @author Sam Brannen
6163
* @since 1.1
6264
* @see #setTransactionManager
6365
* @see #setTransactionAttributes
@@ -120,8 +122,14 @@ public static TransactionStatus currentTransactionStatus() throws NoTransactionE
120122

121123
protected final Log logger = LogFactory.getLog(getClass());
122124

125+
/**
126+
* Default transaction manager bean name.
127+
*/
123128
private String transactionManagerBeanName;
124129

130+
/**
131+
* Default transaction manager.
132+
*/
125133
private PlatformTransactionManager transactionManager;
126134

127135
private TransactionAttributeSource transactionAttributeSource;
@@ -144,14 +152,18 @@ protected final String getTransactionManagerBeanName() {
144152
}
145153

146154
/**
147-
* Specify the target transaction manager.
155+
* Specify the <em>default</em> transaction manager to use to drive transactions.
156+
* <p>The default transaction manager will be used if a <em>qualifier</em>
157+
* has not been declared for a given transaction or if an explicit name for the
158+
* default transaction manager bean has not been specified.
159+
* @see #setTransactionManagerBeanName
148160
*/
149161
public void setTransactionManager(PlatformTransactionManager transactionManager) {
150162
this.transactionManager = transactionManager;
151163
}
152164

153165
/**
154-
* Return the transaction manager, if specified.
166+
* Return the default transaction manager, or {@code null} if unknown.
155167
*/
156168
public PlatformTransactionManager getTransactionManager() {
157169
return this.transactionManager;
@@ -351,7 +363,7 @@ else if (this.transactionManagerBeanName != null) {
351363
return txManager;
352364
}
353365
else {
354-
// Lookup the default transaction manager and store it for next call
366+
// Look up the default transaction manager and cache it for subsequent calls
355367
this.transactionManager = this.beanFactory.getBean(PlatformTransactionManager.class);
356368
return this.transactionManager;
357369
}

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionInterceptor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public TransactionInterceptor() {
6262

6363
/**
6464
* Create a new TransactionInterceptor.
65-
* @param ptm the transaction manager to perform the actual transaction management
65+
* @param ptm the default transaction manager to perform the actual transaction management
6666
* @param attributes the transaction attributes in properties format
6767
* @see #setTransactionManager
6868
* @see #setTransactionAttributes(java.util.Properties)
@@ -74,7 +74,7 @@ public TransactionInterceptor(PlatformTransactionManager ptm, Properties attribu
7474

7575
/**
7676
* Create a new TransactionInterceptor.
77-
* @param ptm the transaction manager to perform the actual transaction management
77+
* @param ptm the default transaction manager to perform the actual transaction management
7878
* @param tas the attribute source to be used to find transaction attributes
7979
* @see #setTransactionManager
8080
* @see #setTransactionAttributeSource(TransactionAttributeSource)

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionProxyFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe
120120

121121

122122
/**
123-
* Set the transaction manager. This will perform actual
123+
* Set the default transaction manager. This will perform actual
124124
* transaction management: This class is just a way of invoking it.
125125
* @see TransactionInterceptor#setTransactionManager
126126
*/

0 commit comments

Comments
 (0)