From 9a89cf81b8700587ede7d0683b86ade24f976d7d Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 22 一月 2024 00:33:04 +0800
Subject: [PATCH] 添加多数据源配置实例

---
 src/main/resources/application-dev.yml |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index e149886..af9bd31 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -24,18 +24,22 @@
     timeout: 10000
     # mysql鏁版嵁婧�
   datasource:
-    type: com.zaxxer.hikari.HikariDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
-    username: root
-    password: root
-    hikari:
-      connection-timeout: 20000             # 鏄鎴风绛夊緟杩炴帴姹犺繛鎺ョ殑鏈�澶ф绉掓暟
-      initialSize: 10                       # 杩炴帴姹犲垵濮嬪寲杩炴帴鏁�
-      maximum-pool-size: 200                # 杩炴帴姹犳渶澶ц繛鎺ユ暟
-      minimum-idle: 5                       # 杩炴帴姹犳渶灏忕┖闂茶繛鎺ユ暟
-      idle-timeout: 300000                  # 鍏佽杩炴帴鍦ㄨ繛鎺ユ睜涓┖闂茬殑鏈�闀挎椂闂达紙浠ユ绉掍负鍗曚綅锛�
-      max-lifetime: 1200000                 # 鏄睜涓繛鎺ュ叧闂悗鐨勬渶闀跨敓鍛藉懆鏈燂紙浠ユ绉掍负鍗曚綅)
+    dynamic:
+      primary: master
+      datasource:
+        master:
+          type: com.zaxxer.hikari.HikariDataSource
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
+          username: root
+          password: root123
+          hikari:
+            connection-timeout: 20000             # 鏄鎴风绛夊緟杩炴帴姹犺繛鎺ョ殑鏈�澶ф绉掓暟
+            initialSize: 50                       # 杩炴帴姹犲垵濮嬪寲杩炴帴鏁�
+            maximum-pool-size: 200                # 杩炴帴姹犳渶澶ц繛鎺ユ暟
+            minimum-idle: 10                       # 杩炴帴姹犳渶灏忕┖闂茶繛鎺ユ暟
+            idle-timeout: 300000                  # 鍏佽杩炴帴鍦ㄨ繛鎺ユ睜涓┖闂茬殑鏈�闀挎椂闂达紙浠ユ绉掍负鍗曚綅锛�
+            max-lifetime: 1200000                 # 鏄睜涓繛鎺ュ叧闂悗鐨勬渶闀跨敓鍛藉懆鏈燂紙浠ユ绉掍负鍗曚綅)
 #[鍙�塢 WVP鐩戝惉鐨凥TTP绔彛, 缃戦〉鍜屾帴鍙h皟鐢ㄩ兘鏄繖涓鍙�
 server:
   port: 8080

--
Gitblit v1.8.0