|
37 | 37 | import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
|
38 | 38 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
39 | 39 | import org.springframework.context.annotation.Bean;
|
40 |
| -import org.springframework.context.annotation.Configuration; |
41 | 40 | import org.springframework.core.annotation.Order;
|
42 | 41 | import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
|
43 | 42 | import org.springframework.transaction.PlatformTransactionManager;
|
|
53 | 52 | @AutoConfiguration(after = { DataSourceAutoConfiguration.class, TransactionAutoConfiguration.class })
|
54 | 53 | @ConditionalOnClass(DSLContext.class)
|
55 | 54 | @ConditionalOnBean(DataSource.class)
|
| 55 | +@EnableConfigurationProperties(JooqProperties.class) |
56 | 56 | public class JooqAutoConfiguration {
|
57 | 57 |
|
58 | 58 | @Bean
|
@@ -81,31 +81,25 @@ public ExceptionTranslatorExecuteListener jooqExceptionTranslator() {
|
81 | 81 | return ExceptionTranslatorExecuteListener.DEFAULT;
|
82 | 82 | }
|
83 | 83 |
|
84 |
| - @Configuration(proxyBeanMethods = false) |
| 84 | + @Bean |
85 | 85 | @ConditionalOnMissingBean(DSLContext.class)
|
86 |
| - @EnableConfigurationProperties(JooqProperties.class) |
87 |
| - public static class DslContextConfiguration { |
88 |
| - |
89 |
| - @Bean |
90 |
| - public DefaultDSLContext dslContext(org.jooq.Configuration configuration) { |
91 |
| - return new DefaultDSLContext(configuration); |
92 |
| - } |
93 |
| - |
94 |
| - @Bean |
95 |
| - @ConditionalOnMissingBean(org.jooq.Configuration.class) |
96 |
| - public DefaultConfiguration jooqConfiguration(JooqProperties properties, ConnectionProvider connectionProvider, |
97 |
| - DataSource dataSource, ObjectProvider<TransactionProvider> transactionProvider, |
98 |
| - ObjectProvider<ExecuteListenerProvider> executeListenerProviders, |
99 |
| - ObjectProvider<DefaultConfigurationCustomizer> configurationCustomizers) { |
100 |
| - DefaultConfiguration configuration = new DefaultConfiguration(); |
101 |
| - configuration.set(properties.determineSqlDialect(dataSource)); |
102 |
| - configuration.set(connectionProvider); |
103 |
| - transactionProvider.ifAvailable(configuration::set); |
104 |
| - configuration.set(executeListenerProviders.orderedStream().toArray(ExecuteListenerProvider[]::new)); |
105 |
| - configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration)); |
106 |
| - return configuration; |
107 |
| - } |
| 86 | + public DefaultDSLContext dslContext(org.jooq.Configuration configuration) { |
| 87 | + return new DefaultDSLContext(configuration); |
| 88 | + } |
108 | 89 |
|
| 90 | + @Bean |
| 91 | + @ConditionalOnMissingBean(org.jooq.Configuration.class) |
| 92 | + public DefaultConfiguration jooqConfiguration(JooqProperties properties, ConnectionProvider connectionProvider, |
| 93 | + DataSource dataSource, ObjectProvider<TransactionProvider> transactionProvider, |
| 94 | + ObjectProvider<ExecuteListenerProvider> executeListenerProviders, |
| 95 | + ObjectProvider<DefaultConfigurationCustomizer> configurationCustomizers) { |
| 96 | + DefaultConfiguration configuration = new DefaultConfiguration(); |
| 97 | + configuration.set(properties.determineSqlDialect(dataSource)); |
| 98 | + configuration.set(connectionProvider); |
| 99 | + transactionProvider.ifAvailable(configuration::set); |
| 100 | + configuration.set(executeListenerProviders.orderedStream().toArray(ExecuteListenerProvider[]::new)); |
| 101 | + configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration)); |
| 102 | + return configuration; |
109 | 103 | }
|
110 | 104 |
|
111 | 105 | }
|
0 commit comments