Allow user-provided ExecuteListenerProvider to go after Boot's
Closes gh-14598
This commit is contained in:
parent
7e4b22d25e
commit
7cbee701cd
|
|
@ -45,6 +45,7 @@ import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfigu
|
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
|
|
@ -79,6 +80,7 @@ public class JooqAutoConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
@Order(0)
|
||||
public DefaultExecuteListenerProvider jooqExceptionTranslatorExecuteListenerProvider() {
|
||||
return new DefaultExecuteListenerProvider(new JooqExceptionTranslator());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import org.jooq.TransactionListenerProvider;
|
|||
import org.jooq.TransactionalRunnable;
|
||||
import org.jooq.VisitListener;
|
||||
import org.jooq.VisitListenerProvider;
|
||||
import org.jooq.impl.DefaultExecuteListenerProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
|
@ -45,6 +46,7 @@ import org.springframework.boot.jdbc.DataSourceBuilder;
|
|||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
|
@ -150,8 +152,13 @@ public class JooqAutoConfigurationTests {
|
|||
.isEqualTo(TestExecutorProvider.class);
|
||||
assertThat(dsl.configuration().recordListenerProviders().length)
|
||||
.isEqualTo(1);
|
||||
assertThat(dsl.configuration().executeListenerProviders().length)
|
||||
.isEqualTo(2);
|
||||
ExecuteListenerProvider[] executeListenerProviders = dsl
|
||||
.configuration().executeListenerProviders();
|
||||
assertThat(executeListenerProviders.length).isEqualTo(2);
|
||||
assertThat(executeListenerProviders[0])
|
||||
.isInstanceOf(DefaultExecuteListenerProvider.class);
|
||||
assertThat(executeListenerProviders[1])
|
||||
.isInstanceOf(TestExecuteListenerProvider.class);
|
||||
assertThat(dsl.configuration().visitListenerProviders().length)
|
||||
.isEqualTo(1);
|
||||
assertThat(dsl.configuration().transactionListenerProviders().length)
|
||||
|
|
@ -260,6 +267,7 @@ public class JooqAutoConfigurationTests {
|
|||
|
||||
}
|
||||
|
||||
@Order(100)
|
||||
protected static class TestExecuteListenerProvider
|
||||
implements ExecuteListenerProvider {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue