Configuration classes annotated with @EnableTransactionManagement that wish to
(or need to) explicitly specify the default PlatformTransactionManager bean
(or 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 PlatformTransactionManager
beans (or two ReactiveTransactionManager beans) present in the container.
See @EnableTransactionManagement for general examples and context;
see 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
PlatformTransactionManager @Bean methods (or
ReactiveTransactionManager @Bean methods) as
@Primary.
This is even generally preferred since it doesn't lead to early initialization
of the TransactionManager bean.
EnableTransactionManagement, org.springframework.context.annotation.Primary , org.springframework.transaction.PlatformTransactionManager , org.springframework.transaction.ReactiveTransactionManager
| Modifier and Type | Method and Description |
|---|---|
| public TransactionManager | Returns: aorg. or
org. implementationReturn the default transaction manager bean to use for annotation-driven database
transaction management, i.e. when processing |
| annotationDrivenTransactionManager | back to summary |
|---|---|
| public TransactionManager annotationDrivenTransactionManager() Return the default transaction manager bean to use for annotation-driven database
transaction management, i.e. when processing There are two basic approaches to implementing this method: 1. Implement the method and annotate it with
In this case, the implementing | |