mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 19:50:06 +08:00
提供一个 Spring Boot 读取多配置文件的示例
This commit is contained in:
parent
612861c955
commit
b8015e87b3
@ -5,10 +5,14 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableAdminServer
|
@EnableAdminServer // TODO 芋艿:需要迁移出去
|
||||||
public class DashboardApplication {
|
public class DashboardApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
// 设置读取的配置文件
|
||||||
|
System.setProperty("spring.config.name", "application,db");
|
||||||
|
|
||||||
|
// 启动 Spring Boot
|
||||||
SpringApplication.run(DashboardApplication.class, args);
|
SpringApplication.run(DashboardApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,6 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: dashboard
|
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 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1 # 地址
|
host: 127.0.0.1 # 地址
|
||||||
|
7
src/main/resources/db.yaml
Normal file
7
src/main/resources/db.yaml
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user