diff --git a/spring-tx/src/main/java/org/springframework/transaction/PlatformTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/PlatformTransactionManager.java index 954eebab332e..f15e2f3700c6 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/PlatformTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/PlatformTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -19,8 +19,8 @@ import org.springframework.lang.Nullable; /** - * This is the central interface in Spring's transaction infrastructure. - * Applications can use this directly, but it is not primarily meant as API: + * This is the central interface in Spring's imperative transaction infrastructure. + * Applications can use this directly, but it is not primarily meant as an API: * Typically, applications will work with either TransactionTemplate or * declarative transaction demarcation through AOP. * @@ -41,6 +41,7 @@ * @since 16.05.2003 * @see org.springframework.transaction.support.TransactionTemplate * @see org.springframework.transaction.interceptor.TransactionInterceptor + * @see org.springframework.transaction.ReactiveTransactionManager */ public interface PlatformTransactionManager extends TransactionManager { diff --git a/spring-tx/src/main/java/org/springframework/transaction/ReactiveTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/ReactiveTransactionManager.java index 47e423d946ba..64341ebb0310 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/ReactiveTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/ReactiveTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -22,7 +22,7 @@ /** * This is the central interface in Spring's reactive transaction infrastructure. - * Applications can use this directly, but it is not primarily meant as API: + * Applications can use this directly, but it is not primarily meant as an API: * Typically, applications will work with either transactional operators or * declarative transaction demarcation through AOP. * @@ -31,6 +31,7 @@ * @since 5.2 * @see org.springframework.transaction.reactive.TransactionalOperator * @see org.springframework.transaction.interceptor.TransactionInterceptor + * @see org.springframework.transaction.PlatformTransactionManager */ public interface ReactiveTransactionManager extends TransactionManager { diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java index 1daef74c7320..e5e23cd7d49b 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/EnableTransactionManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. @@ -30,7 +30,14 @@ * Enables Spring's annotation-driven transaction management capability, similar to * the support found in Spring's {@code } XML namespace. To be used on * {@link org.springframework.context.annotation.Configuration @Configuration} - * classes as follows: + * classes to configure traditional, imperative transaction management or + * reactive transaction management. + * + *

The following example demonstrates imperative transaction management + * using a {@link org.springframework.transaction.PlatformTransactionManager + * PlatformTransactionManager}. For reactive transaction management, configure a + * {@link org.springframework.transaction.ReactiveTransactionManager + * ReactiveTransactionManager} instead. * *

  * @Configuration
@@ -83,12 +90,12 @@
  * methods are invoked.
  *
  * 

A minor difference between the two examples lies in the naming of the {@code - * PlatformTransactionManager} bean: In the {@code @Bean} case, the name is + * TransactionManager} bean: In the {@code @Bean} case, the name is * "txManager" (per the name of the method); in the XML case, the name is * "transactionManager". The {@code } is hard-wired to * look for a bean named "transactionManager" by default, however * {@code @EnableTransactionManagement} is more flexible; it will fall back to a by-type - * lookup for any {@code PlatformTransactionManager} bean in the container. Thus the name + * lookup for any {@code TransactionManager} bean in the container. Thus the name * can be "txManager", "transactionManager", or "tm": it simply does not matter. * *

For those that wish to establish a more direct relationship between @@ -123,8 +130,8 @@ * } * }

* - * This approach may be desirable simply because it is more explicit, or it may be - * necessary in order to distinguish between two {@code PlatformTransactionManager} beans + *

This approach may be desirable simply because it is more explicit, or it may be + * necessary in order to distinguish between two {@code TransactionManager} beans * present in the same container. As the name suggests, the * {@code annotationDrivenTransactionManager()} will be the one used for processing * {@code @Transactional} methods. See {@link TransactionManagementConfigurer} Javadoc diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java index 3c2046c97a54..8b8277851250 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/Transactional.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 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. @@ -71,12 +71,14 @@ /** * A qualifier value for the specified transaction. - *

May be used to determine the target transaction manager, - * matching the qualifier value (or the bean name) of a specific - * {@link org.springframework.transaction.PlatformTransactionManager} + *

May be used to determine the target transaction manager, matching the + * qualifier value (or the bean name) of a specific + * {@link org.springframework.transaction.TransactionManager TransactionManager} * bean definition. * @since 4.2 * @see #value + * @see org.springframework.transaction.PlatformTransactionManager + * @see org.springframework.transaction.ReactiveTransactionManager */ @AliasFor("value") String transactionManager() default ""; 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 c2d9bf5599ab..ebc56af8f109 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 @@ -70,8 +70,8 @@ * management, and a {@link TransactionAttributeSource} (e.g. annotation-based) is used * for determining transaction definitions for a particular class or method. * - *

A transaction aspect is serializable if its {@code PlatformTransactionManager} - * and {@code TransactionAttributeSource} are serializable. + *

A transaction aspect is serializable if its {@code TransactionManager} and + * {@code TransactionAttributeSource} are serializable. * * @author Rod Johnson * @author Juergen Hoeller @@ -282,7 +282,7 @@ public TransactionAttributeSource getTransactionAttributeSource() { } /** - * Set the BeanFactory to use for retrieving PlatformTransactionManager beans. + * Set the BeanFactory to use for retrieving {@code TransactionManager} beans. */ @Override public void setBeanFactory(@Nullable BeanFactory beanFactory) { @@ -290,7 +290,7 @@ public void setBeanFactory(@Nullable BeanFactory beanFactory) { } /** - * Return the BeanFactory to use for retrieving PlatformTransactionManager beans. + * Return the BeanFactory to use for retrieving {@code TransactionManager} beans. */ @Nullable protected final BeanFactory getBeanFactory() { @@ -318,7 +318,8 @@ public void afterPropertiesSet() { /** * General delegate for around-advice-based subclasses, delegating to several other template * methods on this class. Able to handle {@link CallbackPreferringPlatformTransactionManager} - * as well as regular {@link PlatformTransactionManager} implementations. + * as well as regular {@link PlatformTransactionManager} implementations and + * {@link ReactiveTransactionManager} implementations for reactive return types. * @param method the Method being invoked * @param targetClass the target class that we're invoking the method on * @param invocation the callback to use for proceeding with the target invocation diff --git a/src/docs/asciidoc/data-access.adoc b/src/docs/asciidoc/data-access.adoc index e886e7bc95a4..0a319e148b1b 100644 --- a/src/docs/asciidoc/data-access.adoc +++ b/src/docs/asciidoc/data-access.adoc @@ -1160,7 +1160,7 @@ the default transactional configuration, you could write the following: - + ---- @@ -1216,7 +1216,7 @@ transactional settings: - + ---- @@ -1385,7 +1385,7 @@ In XML configuration, the `` tag provides similar conveni - <1> + <1>