|
40 | 40 | import org.springframework.transaction.TransactionDefinition;
|
41 | 41 | import org.springframework.transaction.TransactionStatus;
|
42 | 42 | import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource;
|
| 43 | +import org.springframework.transaction.annotation.Transactional; |
43 | 44 | import org.springframework.transaction.interceptor.TransactionAttribute;
|
44 | 45 | import org.springframework.transaction.interceptor.TransactionAttributeSource;
|
45 | 46 | import org.springframework.util.Assert;
|
|
49 | 50 | /**
|
50 | 51 | * {@code TestExecutionListener} that provides support for executing tests
|
51 | 52 | * within <em>test-managed transactions</em> by honoring Spring's
|
52 |
| - * {@link org.springframework.transaction.annotation.Transactional @Transactional} |
53 |
| - * annotation. |
| 53 | + * {@link Transactional @Transactional} annotation. |
54 | 54 | *
|
55 | 55 | * <h3>Test-managed Transactions</h3>
|
56 | 56 | * <p><em>Test-managed transactions</em> are transactions that are managed
|
|
76 | 76 | * <em>not</em> annotated with {@code @Transactional} (at the class or method
|
77 | 77 | * level) will not be run within a transaction. Furthermore, tests that
|
78 | 78 | * <em>are</em> annotated with {@code @Transactional} but have the
|
79 |
| - * {@link org.springframework.transaction.annotation.Transactional#propagation propagation} |
80 |
| - * type set to |
| 79 | + * {@link Transactional#propagation propagation} type set to |
81 | 80 | * {@link org.springframework.transaction.annotation.Propagation#NOT_SUPPORTED NOT_SUPPORTED}
|
82 | 81 | * will not be run within a transaction.
|
83 | 82 | *
|
|
109 | 108 | * {@code ApplicationContext} for the test. In case there are multiple
|
110 | 109 | * instances of {@code PlatformTransactionManager} within the test's
|
111 | 110 | * {@code ApplicationContext}, a <em>qualifier</em> may be declared via
|
112 |
| - * {@link org.springframework.transaction.annotation.Transactional @Transactional} |
113 |
| - * (e.g., {@code @Transactional("myTxMgr")} or {@code @Transactional(transactionManger = "myTxMgr")}, |
114 |
| - * or {@link org.springframework.transaction.annotation.TransactionManagementConfigurer |
| 111 | + * {@link Transactional @Transactional} (e.g., {@code @Transactional("myTxMgr")} |
| 112 | + * or {@code @Transactional(transactionManger = "myTxMgr")}, or |
| 113 | + * {@link org.springframework.transaction.annotation.TransactionManagementConfigurer |
115 | 114 | * TransactionManagementConfigurer} can be implemented by an
|
116 | 115 | * {@link org.springframework.context.annotation.Configuration @Configuration}
|
117 | 116 | * class. See {@link TestContextTransactionUtils#retrieveTransactionManager}
|
118 | 117 | * for details on the algorithm used to look up a transaction manager in
|
119 | 118 | * the test's {@code ApplicationContext}.
|
120 | 119 | *
|
| 120 | + * <h3>{@code @Transactional} Attribute Support</h3> |
| 121 | + * <table border="1"> |
| 122 | + * <tr><th>Attribute</th><th>Supported for test-managed transactions</th></tr> |
| 123 | + * <tr><td>{@link Transactional#value value} and {@link Transactional#transactionManager transactionManager}</td><td>yes</td></tr> |
| 124 | + * <tr><td>{@link Transactional#propagation propagation}</td> |
| 125 | + * <td>only {@link org.springframework.transaction.annotation.Propagation#NOT_SUPPORTED NOT_SUPPORTED} is supported</td></tr> |
| 126 | + * <tr><td>{@link Transactional#isolation isolation}</td><td>no</td></tr> |
| 127 | + * <tr><td>{@link Transactional#timeout timeout}</td><td>no</td></tr> |
| 128 | + * <tr><td>{@link Transactional#readOnly readOnly}</td><td>no</td></tr> |
| 129 | + * <tr><td>{@link Transactional#rollbackFor rollbackFor} and {@link Transactional#rollbackForClassName rollbackForClassName}</td> |
| 130 | + * <td>no: use {@link TestTransaction#flagForRollback()} instead</td></tr> |
| 131 | + * <tr><td>{@link Transactional#noRollbackFor noRollbackFor} and {@link Transactional#noRollbackForClassName noRollbackForClassName}</td> |
| 132 | + * <td>no: use {@link TestTransaction#flagForCommit()} instead</td></tr> |
| 133 | + * </table> |
| 134 | + * |
121 | 135 | * @author Sam Brannen
|
122 | 136 | * @author Juergen Hoeller
|
123 | 137 | * @since 2.5
|
@@ -153,7 +167,7 @@ public final int getOrder() {
|
153 | 167 | * <p>Note that if a {@code @BeforeTransaction} method fails, any remaining
|
154 | 168 | * {@code @BeforeTransaction} methods will not be invoked, and a transaction
|
155 | 169 | * will not be started.
|
156 |
| - * @see org.springframework.transaction.annotation.Transactional |
| 170 | + * @see Transactional @Transactional |
157 | 171 | * @see #getTransactionManager(TestContext, String)
|
158 | 172 | */
|
159 | 173 | @Override
|
|
0 commit comments