Polish Javadoc for TransactionManagementConfigurer

This commit is contained in:
Sam Brannen 2020-04-06 15:31:48 +02:00
parent 144b0e1437
commit 1d0c5195bc
1 changed files with 9 additions and 7 deletions

View File

@ -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.
*
* <p>See @{@link EnableTransactionManagement} for general examples and context;
* see {@link #annotationDrivenTransactionManager()} for detailed instructions.
*
* <p>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 {
* <p>There are two basic approaches to implementing this method:
* <h3>1. Implement the method and annotate it with {@code @Bean}</h3>
* 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:
* <pre class="code">
* &#064;Bean
@ -76,9 +77,10 @@ public interface TransactionManagementConfigurer {
* with {@code @Bean}!
* <p>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
*/