找回密码
 立即注册
查看: 3|回复: 0

41,多环境开发-Profiles

[复制链接]

243

主题

6

精华

247

金币

技术维护QQ:515138

积分
530
发表于 昨天 13:42 | 显示全部楼层 |阅读模式
SpringBoot提供的Profiles可以用来隔离应用程序配置的各个部分,并在特定环境下指定部分配置生效
1.jpg
多环境开发,单文件使用:
  1. #通用信息,指定生效的环境
  2. #多环境下共性的属性
  3. #如果特定环境中的配置和通用信息冲突了,特定环境中的配置生效
  4. spring:
  5.   profiles:
  6.     active: dev
  7. server:
  8.   servlet:
  9.     context-path: /aaa
  10. ---
  11. #开发环境
  12. spring:
  13.   config:
  14.     activate:
  15.       on-profile: dev
  16. server:
  17.   port: 8081
  18.   servlet:
  19.     context-path: /bbb
  20. ---
  21. #测试环境
  22. spring:
  23.   config:
  24.     activate:
  25.       on-profile: test
  26. server:
  27.   port: 8082
  28. ---
  29. #生成环境
  30. spring:
  31.   config:
  32.     activate:
  33.       on-profile: pro
  34. server:
  35.   port: 8083
复制代码
多环境开发,多文件配置:
1.jpg
  1. #指定激活的环境
  2. spring:
  3.   profiles:
  4.     active: test
复制代码

2.jpg 3.jpg



上一篇:40,属性配置方式
下一篇:42,多环境开发-Pofiles-分组
网站建设,公众号小程序开发,系统定制,软件App开发,技术维护【联系我们】手机/微信:17817817816 QQ:515138

QQ|Archiver|自丢网 ( 粤ICP备2024252464号-1 )

GMT+8, 2026-3-4 07:08

专注于网站建设,公众号小程序制作,商城小程序,系统定制,软件App开发

【联系我们】手机/微信:17817817816 QQ:515138

快速回复 返回顶部 返回列表