diff --git a/msb-mall/mall-commons/pom.xml b/msb-mall/mall-commons/pom.xml
index a8d806e03..e18d6b279 100644
--- a/msb-mall/mall-commons/pom.xml
+++ b/msb-mall/mall-commons/pom.xml
@@ -56,6 +56,15 @@
com.alibaba.cloud
spring-cloud-starter-alibaba-seata
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+ 2.3.7.RELEASE
+
diff --git a/msb-mall/mall-coupon/pom.xml b/msb-mall/mall-coupon/pom.xml
index 9205a2463..a02214169 100644
--- a/msb-mall/mall-coupon/pom.xml
+++ b/msb-mall/mall-coupon/pom.xml
@@ -21,6 +21,13 @@
com.msb.mall
mall-commons
1.0-SNAPSHOT
+
+
+ javax.validation
+ validation-api
+
+
+
org.springframework.boot
diff --git a/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/MallCouponApplication.java b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/MallCouponApplication.java
index 526cdad44..ff21fbb7a 100644
--- a/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/MallCouponApplication.java
+++ b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/MallCouponApplication.java
@@ -3,10 +3,10 @@ package com.msb.mall.coupon;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDiscoveryClient
-@SpringBootApplication
@MapperScan("com.msb.mall.coupon.dao")
public class MallCouponApplication {
diff --git a/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/controller/CouponController.java b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/controller/CouponController.java
index 5530c9e90..ea3c8b9f3 100644
--- a/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/controller/CouponController.java
+++ b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/controller/CouponController.java
@@ -3,6 +3,7 @@ package com.msb.mall.coupon.controller;
import java.util.Arrays;
import java.util.Map;
+import com.msb.mall.coupon.datasource.ReadOnlyConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@@ -34,6 +35,7 @@ public class CouponController {
* 列表
*/
@RequestMapping("/list")
+ @ReadOnlyConnection
public R list(@RequestParam Map params){
PageUtils page = couponService.queryPage(params);
diff --git a/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/datasource/DataSourceConfiguration.java b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/datasource/DataSourceConfiguration.java
new file mode 100644
index 000000000..cd4c460ea
--- /dev/null
+++ b/msb-mall/mall-coupon/src/main/java/com/msb/mall/coupon/datasource/DataSourceConfiguration.java
@@ -0,0 +1,47 @@
+package com.msb.mall.coupon.datasource;
+
+import com.zaxxer.hikari.HikariDataSource;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.sql.DataSource;
+import java.util.HashMap;
+import java.util.Map;
+
+
+@Configuration
+@EnableTransactionManagement
+public class DataSourceConfiguration {
+
+ @Bean(name = "masterDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource.master")
+ public DataSource masterDataSource() {
+ return DataSourceBuilder.create().type(HikariDataSource.class).build();
+ }
+
+ @Bean(name = "slaveDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource.slave")
+ public DataSource slaveDataSource() {
+ return DataSourceBuilder.create().type(HikariDataSource.class).build();
+ }
+
+
+ @Bean("routingDataSource")
+ @Primary
+ public AbstractRoutingDataSource roundRobinDataSouceProxy() {
+ ReadWriteSplitRoutingDataSource proxy = new ReadWriteSplitRoutingDataSource();
+ Map