1 Star 0 Fork 29

柚子 / notebook

forked from JustryDeng / notebook 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
[13]指定多个配置文件.md 827 Bytes
一键复制 编辑 原始数据 按行查看 历史
JustryDeng 提交于 2023-04-18 15:56 . 指定多个配置文件

指定多个配置文件

示例说明

提示:

  • 方式较多,这里只说明一下本人常用的
  • 本人测试使用的spring-boot >= 2.4.0

假设我们在dev环境需要同时激活两个配置

application.properties
application-a.properties
application-b.properties

我们只需要在application.properties中这样配置即可

# 指定
spring.profiles.active=dev

# profiles分组. spring.profiles.group.xxx,激活时指定spring.profiles.active=xxx即可
spring.profiles.group.dev[0]=a
spring.profiles.group.dev[1]=b

相关资料

1
https://gitee.com/WY784755850/notebook.git
git@gitee.com:WY784755850/notebook.git
WY784755850
notebook
notebook
master

搜索帮助