【问题标题】:Spring profiles group弹簧型材组
【发布时间】:2021-11-04 11:02:13
【问题描述】:

我决定处理个人资料并分组

spring:
//Common settings

---

spring:
  profiles:
    group:
      default:
        - prod
        - actuator
      dev:
        - dev
        - actuatorDev
      uat:
        - uat
        - actuatorUat

为什么当我指定 dev 或 uat 时。 设置从主块加载,然后从 dev 或 uat 替换。最重要的是执行器配置文件

当我没有在启动时指定配置文件时,理论上它只是默认值 这种魔法不会发生

如何正确实现通用设置,然后根据default、dev、uat配置文件替换它们?

【问题讨论】:

    标签: spring spring-boot spring-profiles


    【解决方案1】:

    请测试:

    //...  
    spring:
      profiles:
        default: "prod,actuator" # when no profile*S* set [3.]
        group:  # ...according to [3.1] and [3.2]
          dev:
            - "dev"
            - "actuatorDev"
          uat:
            - "uat"
            - "actuatorUat"
    

    Spring (current) Ref: Chap. 3 Profiles

    【讨论】:

      猜你喜欢
      • 2012-12-18
      • 2012-08-05
      • 2020-03-01
      • 2016-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多