简体   繁体   中英

Spring profiles group

I decided to deal with the profiles and divide into groups

spring:
//Common settings

---

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

Why when I specify dev or uat. The settings are loaded from the main block, then replaced from dev or uat. And on top is the actuator profile

And when I don't specify the profile at startup, in theory it's just default This kind of magic doesn't happen

How to correctly implement general settings and then replace them depending on the default, dev, uat profile?

Please Test:

//...  
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM