Skip to content

Commit

Permalink
Configure jOOQ ConnectionProvider via customizer
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye committed Jan 18, 2021
1 parent dcae55a commit 367c353
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ public DefaultDSLContext dslContext(org.jooq.Configuration configuration) {

@Bean
@ConditionalOnMissingBean(org.jooq.Configuration.class)
public DefaultConfiguration jooqConfiguration(JooqProperties properties, ConnectionProvider connectionProvider,
DataSource dataSource, ObjectProvider<DefaultConfigurationCustomizer> configurationCustomizers) {
public DefaultConfiguration jooqConfiguration(JooqProperties properties, DataSource dataSource,
ObjectProvider<DefaultConfigurationCustomizer> configurationCustomizers) {
DefaultConfiguration configuration = new DefaultConfiguration();
configuration.set(properties.determineSqlDialect(dataSource));
configuration.set(connectionProvider);
configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration));
return configuration;
}

@Bean
@Deprecated
public DefaultConfigurationCustomizer jooQProviderDefaultConfigurationCustomizer(
public DefaultConfigurationCustomizer jooqProviderDefaultConfigurationCustomizer(
ObjectProvider<ConnectionProvider> connectionProvider,
ObjectProvider<TransactionProvider> transactionProvider,
ObjectProvider<RecordMapperProvider> recordMapperProvider,
ObjectProvider<RecordUnmapperProvider> recordUnmapperProvider, ObjectProvider<Settings> settings,
Expand All @@ -115,6 +115,7 @@ public DefaultConfigurationCustomizer jooQProviderDefaultConfigurationCustomizer
ObjectProvider<TransactionListenerProvider> transactionListenerProviders,
ObjectProvider<ExecutorProvider> executorProvider) {
return new OrderedDefaultConfigurationCustomizer((configuration) -> {
connectionProvider.ifAvailable(configuration::set);
transactionProvider.ifAvailable(configuration::set);
recordMapperProvider.ifAvailable(configuration::set);
recordUnmapperProvider.ifAvailable(configuration::set);
Expand Down

0 comments on commit 367c353

Please sign in to comment.