spring.config.activate.on-profile cannot be used in profile specific file #24990
We use the "multi properties files in one" feature of Spring Boot 2.4.
With the change from Spring Boot 2.4.1 to 2.4.2 the following does no longer work:
If I incorrectly used this feature I apologize upfront.
The text was updated successfully, but these errors were encountered:
Thanks for the report. I was going to close this as a duplicate of #24941 but this case is a little different.
The change in behaviour is due to #24733. The intent of this issue was to start failing when a property is used that was previously being silently ignored. However, in this case the property wasn't being silently ignored. With the example above, when the
We'll need to decide how we want to handle
If I get the intention right from @markusheiden it would indeed be benefitial to have multiple yaml files contains application properties and each files is sub-structured in sections having their own value for spring.config.activate.on-profile. This way, larger setups with lot's of properties would be very well supported.
You can then organize all logging configuration properties in one property file and depending on the active profile, the part of the yaml file is used.
@wilkinsona: Is that what you have in mind by saying "We're going to try to support spring.config.activate.on-profile in a profile-specific file." in your comment above? Thanks in advance for a short answer on this.
If I understand correctly how it works in 2.4.1, you need to have any of the following profile combinations in your list of active profiles: "logging, production", "logging, staging" or "logging,local". Is this correct? I never tried this myself with 2.4.1 since we are currently upgrading directly to 2.4.2.
Another option would be, to ignore the suffix of the filename application-suffix.yaml and just interpret this file as another application.yaml. This way, the files won't get too long and the profile-specific config for logging is just activated by having any of the following profiles in the list of active profiles: "staging", "production" or "local".