From 0bfb85317ae6f775e71cd44ae5564f54fc9cd386 Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Fri, 21 Apr 2023 18:32:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.yml | 24 +++++++++++++++++++----- src/main/resources/application.yml | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index aa7fc0d7..916487c8 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,11 +3,25 @@ server: spring: datasource: - type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://www.youlai.tech:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true - username: youlai - password: 123456 + # 动态切换数据源 + dynamic: + # 默认库,默认master + primary: master + # 是否严格模式,默认false;严格模式下未匹配到数据源直接报错, 非严格模式下则使用默认数据源primary所设置的数据源 + strict: false + datasource: + master: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://www.youlai.tech:3306/youlai_boot?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true + username: youlai + password: 123456 + slave: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://www.youlai.tech:3306/youlai_boot_slave?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true + username: youlai + password: 123456 data: redis: database: 6 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7f594dbb..a921d541 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,5 +4,5 @@ spring: profiles: active: dev mvc: - pathmatch: + path-match: matching-strategy: ant_path_matcher \ No newline at end of file