OctaviusSpringAutoConfiguration

@AutoConfiguration(after = [DataSourceAutoConfiguration::class, TransactionManagerCustomizationAutoConfiguration::class], before = [DataSourceTransactionManagerAutoConfiguration::class, TransactionAutoConfiguration::class])
@ConditionalOnClass(value = [OctaviusSession::class, DataSource::class])
@ConditionalOnSingleCandidate(value = DataSource::class)
open class OctaviusSpringAutoConfiguration

Spring Boot auto-configuration for the Octavius driver.

Runs after Spring's own DataSourceAutoConfiguration, and after Boot's TransactionManagerCustomizationAutoConfiguration, whose customizers its transaction manager takes; and before Boot's DataSourceTransactionManagerAutoConfiguration and TransactionAutoConfiguration. Contributes an OctaviusTemplate and an OctaviusJdbcTransactionManager, each only when the application context does not already declare one of its own - any TransactionManager counting for the second. Declaring either bean yourself takes precedence over everything here.

It stands back where Boot's own JDBC auto-configuration does: with several DataSource beans and none of them primary, there is no single one to build on, and it contributes nothing.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
@Bean
@ConditionalOnMissingBean
open fun octaviusTemplate(dataSource: DataSource): OctaviusTemplate

Creates and registers an OctaviusTemplate bean if one is not already present in the application context.

Link copied to clipboard
@Bean
@ConditionalOnMissingBean(value = [TransactionManager::class])
open fun transactionManager(dataSource: DataSource, customizers: ObjectProvider<TransactionManagerCustomizers>): OctaviusJdbcTransactionManager

Creates and registers an OctaviusJdbcTransactionManager if the application context declares no TransactionManager of its own - JDBC, JPA or reactive alike, as for Boot's own. Declared as the class it is, so a bean created before it can inject it by that type.