From b8015e87b386ffd42fcb92cdcd6fe726b83281a2 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 6 Feb 2021 11:45:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E4=B8=80=E4=B8=AA=20Spring?= =?UTF-8?q?=20Boot=20=E8=AF=BB=E5=8F=96=E5=A4=9A=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/iocoder/dashboard/DashboardApplication.java | 6 +++++- src/main/resources/application.yaml | 7 ------- src/main/resources/db.yaml | 7 +++++++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/db.yaml diff --git a/src/main/java/cn/iocoder/dashboard/DashboardApplication.java b/src/main/java/cn/iocoder/dashboard/DashboardApplication.java index 32783aa8c..f2092e2b3 100644 --- a/src/main/java/cn/iocoder/dashboard/DashboardApplication.java +++ b/src/main/java/cn/iocoder/dashboard/DashboardApplication.java @@ -5,10 +5,14 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -@EnableAdminServer +@EnableAdminServer // TODO 芋艿:需要迁移出去 public class DashboardApplication { public static void main(String[] args) { + // 设置读取的配置文件 + System.setProperty("spring.config.name", "application,db"); + + // 启动 Spring Boot SpringApplication.run(DashboardApplication.class, args); } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 634cbd325..9fd382e14 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -2,13 +2,6 @@ spring: application: name: dashboard - # 数据源配置项 TODO 多数据源;TODO 监控配置 - datasource: - url: jdbc:mysql://127.0.1:33061/ruoyi-vue-pro?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: 123456 - # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: host: 127.0.0.1 # 地址 diff --git a/src/main/resources/db.yaml b/src/main/resources/db.yaml new file mode 100644 index 000000000..05018f24f --- /dev/null +++ b/src/main/resources/db.yaml @@ -0,0 +1,7 @@ +spring: + # 数据源配置项 TODO 多数据源;TODO 监控配置 + datasource: + url: jdbc:mysql://127.0.1:33061/ruoyi-vue-pro?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + driver-class-name: com.mysql.jdbc.Driver + username: root + password: 123456