'What is the default TransactionManager implementation for a Spring Boot application?

When Spring Data is added as a dependency to a Spring Boot project, which implementation of TransactionManager is available by default?



Solution 1:[1]

I had the same question. After digging through the Spring-Boot I found the following org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#transactionManager (Spring Boot version 2.6.4)

  @Bean
    @ConditionalOnMissingBean({TransactionManager.class})
    public PlatformTransactionManager transactionManager(ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManagerCustomizers.ifAvailable((customizers) -> {
            customizers.customize(transactionManager);
        });
        return transactionManager;
    }

So if you don't have a TransactionManager already defined, the default will be the JpaTransactionManager

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hatsy