From 48c9ea9a3f6e81d73325a3bae9ad6458751046c8 Mon Sep 17 00:00:00 2001 From: duLingLing Date: Fri, 9 Aug 2019 16:31:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Upd:=E6=9B=B4=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E9=93=BE=E6=8E=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 +++++++++-- .../pos/datasource/DataSourceConfiguration.java | 8 +++----- .../datasource/ReadWriteSplitRoutingDataSource.java | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index b24ff9345..adab73376 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 5a0e59d46..610a85c46 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; @@ -20,19 +20,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; } From 74e9350373769ec8adb61816647f45da4f7bf097 Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Fri, 9 Aug 2019 17:04:03 +0800 Subject: [PATCH 2/2] [Y] remove druid --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index adab73376..330efacca 100644 --- a/pom.xml +++ b/pom.xml @@ -165,10 +165,6 @@ mail 1.4.7 - - com.alibaba - druid - com.github.qcloudsms qcloudsms