diff --git a/pom.xml b/pom.xml index 9343a2490..be7f7d70f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ au.com.royalpay.payment payment-parent - 1.0.9 + 1.0.11 4.0.0 manage - 1.1.2 + 1.1.3 UTF-8 @@ -206,6 +206,13 @@ mybatis-spring-boot-starter 1.3.2 + + + + com.zaxxer + HikariCP + 3.2.0 + diff --git a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/DataSourceConfiguration.java b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/DataSourceConfiguration.java index 2b8b606ef..810e36574 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/DataSourceConfiguration.java +++ b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/DataSourceConfiguration.java @@ -1,6 +1,6 @@ package au.com.royalpay.payment.manage.pos.datasource; -import org.springframework.beans.factory.annotation.Value; +import com.zaxxer.hikari.HikariDataSource; import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -19,19 +19,17 @@ import java.util.Map; @Configuration @EnableTransactionManagement public class DataSourceConfiguration { - @Value("${app.datasource.type:'com.alibaba.druid.pool.DruidDataSource'}") - private Class dataSourceType; @Bean(name = "masterDataSource") @ConfigurationProperties(prefix = "app.datasource.master") public DataSource masterDataSource() { - return DataSourceBuilder.create().type(dataSourceType).build(); + return DataSourceBuilder.create().type(HikariDataSource.class).build(); } @Bean(name = "slaveDataSource") @ConfigurationProperties(prefix = "app.datasource.slave") public DataSource slaveDataSource() { - return DataSourceBuilder.create().type(dataSourceType).build(); + return DataSourceBuilder.create().type(HikariDataSource.class).build(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadWriteSplitRoutingDataSource.java b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadWriteSplitRoutingDataSource.java index 8f54862d9..1f3bc62a1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadWriteSplitRoutingDataSource.java +++ b/src/main/java/au/com/royalpay/payment/manage/pos/datasource/ReadWriteSplitRoutingDataSource.java @@ -13,7 +13,7 @@ public class ReadWriteSplitRoutingDataSource extends AbstractRoutingDataSource { @Override public Object determineCurrentLookupKey() { DbContextHolder.DbType dataSource = DbContextHolder.getDbType(); - logger.error("------------------当前数据源:{}---------------------",dataSource); + logger.info("------------------当前数据源:{}---------------------",dataSource); return dataSource; }