Relevant similar (unanswered) question
I am having troubles implementing a simple configuration matrix for multi-tenant multi-environment Spring Boot application.
We have defined two sets of profiles: country_[iso2]
(the tenant!), e.g. country_uk
, country_ro
, country_de
; and the environment, development
, test
, qa
, prod
The thing is I now need to inject some URLs that depend/change according to the combination tenant and environment. A matrix configuration.
And since there is a large number of properties to set, I haven't been following the approach of the linked answer, instead I have created multiple dash-separated-name files
- application.yaml (common for all)
- application-country_xx.yaml (all environments in
xx
share this) - application-country_xx-development.yaml (supposed to match
country_xx & development
) - etc.
When I start the application with either country_xx
, development
, or the opposite, I don't get the value for the property I have set. I am using @ConfigurationProperties
.
In order not to end up with a huge single YAML file I don't like to merge every file into one and using the spring.profiles
key. I prefer separate files.
Am I missing something here?
This is not possible in Spring. Profiles are taken one at a time
Source code
The above evaluates one profile at a time, not all the combinations