Browse Source

增加动态数据库配置

lixing 3 years ago
parent
commit
7c9e0fe211
2 changed files with 18 additions and 8 deletions
  1. 0 6
      pom.xml
  2. 18 2
      src/main/resources/bootstrap.yml

+ 0 - 6
pom.xml

@@ -105,12 +105,6 @@
     <dependency>
         <groupId>com.persagy</groupId>
         <artifactId>apm-mybatis</artifactId>
-        <exclusions>
-            <exclusion>
-                <groupId>com.baomidou</groupId>
-                <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            </exclusion>
-        </exclusions>
     </dependency>
 </dependencies>
 </project>

+ 18 - 2
src/main/resources/bootstrap.yml

@@ -3,7 +3,17 @@ server:
     9977
 spring:
   application:
-    name: energy-alarm-service
+    name: energy_alarm_service
+  datasource:
+    dynamic:
+      primary: master #设置默认的数据源或者数据源组,默认值即为master
+      strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
+      datasource:
+        master:
+          url: ${spring.datasource.url}
+          username: ${spring.datasource.username}
+          password: ${spring.datasource.password}
+          driver-class-name: ${spring.datasource.driver-class-name}
 
 EUREKA_CLIENT_DEFAULT_ZONE: http://frame:123456@develop.persagy.com/integrated-eureka/eureka/
 #EUREKA_CLIENT_DEFAULT_ZONE: http://frame:Hv7MpxJ5pBckigB@47.117.93.148/integrated-eureka/eureka/
@@ -13,4 +23,10 @@ mybatis-plus:
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
-
+swagger:
+  title: energy-alarm-service 接口文档
+  desc: --
+  version: v1.0.0
+  author: lixing
+  serviceUrl: www.persagy.com
+  groupName: api