Use jOOQ enum for sqlDialect

Switch JooqProperties.sqlDialect from a String to the actual enum to
allow IDE hints and case insensitive binding.

Fixes gh-3468
pull/3032/merge
Phillip Webb 9 years ago
parent fd6024ebf1
commit 5dbe6232b8

@ -23,7 +23,6 @@ import org.jooq.DSLContext;
import org.jooq.ExecuteListenerProvider;
import org.jooq.RecordListenerProvider;
import org.jooq.RecordMapperProvider;
import org.jooq.SQLDialect;
import org.jooq.TransactionProvider;
import org.jooq.VisitListenerProvider;
import org.jooq.conf.Settings;
@ -43,7 +42,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.util.StringUtils;
/**
* {@link EnableAutoConfiguration Auto-configuration} for JOOQ.
@ -113,8 +111,8 @@ public class JooqAutoConfiguration {
@ConditionalOnMissingBean(org.jooq.Configuration.class)
public DefaultConfiguration jooqConfiguration() {
DefaultConfiguration configuration = new DefaultConfiguration();
if (!StringUtils.isEmpty(this.properties.getSqlDialect())) {
configuration.set(SQLDialect.valueOf(this.properties.getSqlDialect()));
if (this.properties.getSqlDialect() != null) {
configuration.set(this.properties.getSqlDialect());
}
configuration.set(this.connectionProvider);
if (this.transactionProvider != null) {

@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.jooq;
import org.jooq.SQLDialect;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@ -31,13 +32,13 @@ public class JooqProperties {
* SQLDialect JOOQ used when communicating with the configured datasource, for
* instance "POSTGRES".
*/
private String sqlDialect;
private SQLDialect sqlDialect;
public String getSqlDialect() {
public SQLDialect getSqlDialect() {
return this.sqlDialect;
}
public void setSqlDialect(String sqlDialect) {
public void setSqlDialect(SQLDialect sqlDialect) {
this.sqlDialect = sqlDialect;
}

Loading…
Cancel
Save