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 fdab4eafa7..bf709e5240 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-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. @@ -25,17 +25,18 @@ import org.springframework.transaction.TransactionManager; * (or {@code ReactiveTransactionManager} 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. + * beans (or two {@code ReactiveTransactionManager} beans) present in the container. * *

See @{@link EnableTransactionManagement} for general examples and context; * see {@link #annotationDrivenTransactionManager()} for detailed instructions. * *

Note that in by-type lookup disambiguation cases, an alternative approach to * implementing this interface is to simply mark one of the offending - * {@code PlatformTransactionManager} {@code @Bean} methods as + * {@code PlatformTransactionManager} {@code @Bean} methods (or + * {@code ReactiveTransactionManager} {@code @Bean} methods) as * {@link org.springframework.context.annotation.Primary @Primary}. * This is even generally preferred since it doesn't lead to early initialization - * of the {@code PlatformTransactionManager} bean. + * of the {@code TransactionManager} bean. * * @author Chris Beams * @since 3.1 @@ -52,7 +53,7 @@ public interface TransactionManagementConfigurer { *

There are two basic approaches to implementing this method: *

1. Implement the method and annotate it with {@code @Bean}

* In this case, the implementing {@code @Configuration} class implements this method, - * marks it with {@code @Bean} and configures and returns the transaction manager + * marks it with {@code @Bean}, and configures and returns the transaction manager * directly within the method body: *
 	 * @Bean
@@ -76,9 +77,10 @@ public interface TransactionManagementConfigurer {
 	 * with {@code @Bean}!
 	 * 

In either scenario #1 or #2, it is important that the * {@code PlatformTransactionManager} instance is managed as a Spring bean within the - * container as all {@code PlatformTransactionManager} implementations take advantage + * container since most {@code PlatformTransactionManager} implementations take advantage * of Spring lifecycle callbacks such as {@code InitializingBean} and - * {@code BeanFactoryAware}. + * {@code BeanFactoryAware}. Note that the same guidelines apply to + * {@code ReactiveTransactionManager} beans. * @return a {@link org.springframework.transaction.PlatformTransactionManager} or * {@link org.springframework.transaction.ReactiveTransactionManager} implementation */