diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java index a85621810459..6d608d69af6e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java @@ -175,6 +175,19 @@ void transactionProviderBacksOffOnExistingTransactionProvider() { .run((context) -> { TransactionProvider transactionProvider = context.getBean(TransactionProvider.class); assertThat(transactionProvider).isInstanceOf(CustomTransactionProvider.class); + DSLContext dsl = context.getBean(DSLContext.class); + assertThat(dsl.configuration().transactionProvider()).isSameAs(transactionProvider); + }); + } + + @Test + void transactionProviderFromConfigurationCustomizerOverridesTransactionProviderBean() { + this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class, TxManagerConfiguration.class, + CustomTransactionProviderFromCustomizerConfiguration.class).run((context) -> { + TransactionProvider transactionProvider = context.getBean(TransactionProvider.class); + assertThat(transactionProvider).isInstanceOf(SpringTransactionProvider.class); + DSLContext dsl = context.getBean(DSLContext.class); + assertThat(dsl.configuration().transactionProvider()).isInstanceOf(CustomTransactionProvider.class); }); } @@ -239,6 +252,16 @@ TransactionProvider transactionProvider() { } + @Configuration(proxyBeanMethods = false) + static class CustomTransactionProviderFromCustomizerConfiguration { + + @Bean + DefaultConfigurationCustomizer transactionProviderCustomizer() { + return (configuration) -> configuration.setTransactionProvider(new CustomTransactionProvider()); + } + + } + @Configuration(proxyBeanMethods = false) static class TxManagerConfiguration {