Home > Enterprise >  Spring profiles group
Spring profiles group

Time:11-05

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?

CodePudding user response:

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

  • Related