|
|
@ -113,6 +113,17 @@ class JooqAutoConfigurationTests {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void jooqWithDefaultTransactionProvider() {
|
|
|
|
|
|
|
|
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class, TxManagerConfiguration.class)
|
|
|
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
|
|
|
DSLContext dsl = context.getBean(DSLContext.class);
|
|
|
|
|
|
|
|
TransactionProvider expectedTransactionProvider = context.getBean(TransactionProvider.class);
|
|
|
|
|
|
|
|
TransactionProvider transactionProvider = dsl.configuration().transactionProvider();
|
|
|
|
|
|
|
|
assertThat(transactionProvider).isSameAs(expectedTransactionProvider);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void jooqWithDefaultExecuteListenerProvider() {
|
|
|
|
void jooqWithDefaultExecuteListenerProvider() {
|
|
|
|
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class).run((context) -> {
|
|
|
|
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class).run((context) -> {
|
|
|
@ -164,6 +175,19 @@ class JooqAutoConfigurationTests {
|
|
|
|
.run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
TransactionProvider transactionProvider = context.getBean(TransactionProvider.class);
|
|
|
|
TransactionProvider transactionProvider = context.getBean(TransactionProvider.class);
|
|
|
|
assertThat(transactionProvider).isInstanceOf(CustomTransactionProvider.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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -228,6 +252,16 @@ class JooqAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
|
|
|
static class CustomTransactionProviderFromCustomizerConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
DefaultConfigurationCustomizer transactionProviderCustomizer() {
|
|
|
|
|
|
|
|
return (configuration) -> configuration.setTransactionProvider(new CustomTransactionProvider());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
static class TxManagerConfiguration {
|
|
|
|
static class TxManagerConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|