transactionManager

@Bean
@ConditionalOnMissingBean
open fun transactionManager(dataSource: DataSource): PlatformTransactionManager

Creates and registers a PlatformTransactionManager bean backed by an OctaviusJdbcTransactionManager if one is not already present in the application context.

It carries an OctaviusExceptionTranslator, so a failure raised while the manager itself is committing or rolling back arrives in Spring's DataAccessException hierarchy rather than as a raw SQLException, and it has nested transactions enabled, which is what makes @Transactional(propagation = NESTED) resolve to a savepoint instead of being rejected. What it adds over JdbcTransactionManager is an answer for a transaction whose connection has already left - see the class for which way each of commit and rollback goes, and why they differ.

Return

a new instance of PlatformTransactionManager

Parameters

dataSource

the underlying data source to use