|
|
|
@ -25,6 +25,8 @@ import org.jooq.DSLContext;
|
|
|
|
|
import org.jooq.ExecuteListener;
|
|
|
|
|
import org.jooq.ExecuteListenerProvider;
|
|
|
|
|
import org.jooq.SQLDialect;
|
|
|
|
|
import org.jooq.TransactionContext;
|
|
|
|
|
import org.jooq.TransactionProvider;
|
|
|
|
|
import org.jooq.TransactionalRunnable;
|
|
|
|
|
import org.jooq.impl.DataSourceConnectionProvider;
|
|
|
|
|
import org.jooq.impl.DefaultExecuteListenerProvider;
|
|
|
|
@ -155,6 +157,16 @@ class JooqAutoConfigurationTests {
|
|
|
|
|
.isEqualTo(SQLDialect.POSTGRES));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void transactionProviderBacksOffOnExistingTransactionProvider() {
|
|
|
|
|
this.contextRunner
|
|
|
|
|
.withUserConfiguration(JooqDataSourceConfiguration.class, CustomTransactionProviderConfiguration.class)
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
TransactionProvider transactionProvider = context.getBean(TransactionProvider.class);
|
|
|
|
|
assertThat(transactionProvider).isInstanceOf(CustomTransactionProvider.class);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class AssertFetch implements TransactionalRunnable {
|
|
|
|
|
|
|
|
|
|
private final DSLContext dsl;
|
|
|
|
@ -206,6 +218,16 @@ class JooqAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
static class CustomTransactionProviderConfiguration {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
TransactionProvider transactionProvider() {
|
|
|
|
|
return new CustomTransactionProvider();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
static class TxManagerConfiguration {
|
|
|
|
|
|
|
|
|
@ -226,4 +248,23 @@ class JooqAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class CustomTransactionProvider implements TransactionProvider {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void begin(TransactionContext ctx) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void commit(TransactionContext ctx) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void rollback(TransactionContext ctx) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|