Description
While migrating to SpringBoot 2.4.X, I encountered an issue while migrating from spring.profiles.include
. I drop my questions and some supposed answers here. Fact this Upgrading to SpringBoot 2.4 is a pain in our case as we massively rely on spring.profiles.include
to chain profile activation, and the documentation/migration notes are unclear for our specific-case.
(Sorry for the quite long ticket. This ticket has been turned from I'm completely lost
to Thanks for confirming I'm going the right way, others might be interested
)
First, very helpful links:
https://spring.io/blog/2020/08/14/config-file-processing-in-spring-boot-2-4
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Config-Data-Migration-Guide
#22944
Second, would it be relevant to WARN on such deprecated piece of configuration remaining in the project configuration? With a second thought, this looks a bad idea since #21697 restored this property in some usages. But in my case, it took my a while just to understand this property was removed (i.e. my bad, I did not consider going through Release notes, and the Migration Guide).
In our case, we rely massively on spring.profiles.include
to triggers profiles chained activation. Typically, we have the following profiles:
prod
profile, which includesprod-db
,prod-queue
andprod-common
.prod-db
includescommon-db
andprod-common
prod-queue
includescommon-queue
andprod-common
- etc.
The new group features looks great to ensure prod
triggers prod-db
, prod-queue
and prod-common
, but I'm not sure what's the proper way to handle the rest of the chain of profiles.
Should I introduce a prod-db
groups over common-db
and prod-common
, and a prod-queue
groups over common-queue
and prod-common
? I guess so.
To confirm what it would look like:
spring.profiles.group.prod-db: common-db,prod-common
However, I also understand I have to pack all these groups into some main application.properties: this is not nice for us as we have many such groups, which are currently described as spring.profiles.include
within each profile specific file.
In #22944 (comment), I don't get what is a not in a profile-specific document
. Does not in a profile-specific document
refers to file being imported through spring.config.import
? I guess so.
In addition, given we have multiple applications, each with their own application.yml (and quite a bunch of tests also activating sub-sets of profiles, relying on the chains of profile), I would prefer to push these groups definition into a different specific file. Is spring.config.import
the proper way to handle such a case?
I wonder if spring.profiles.include
could be restored for simple-single profile-specific documents (e.g. document associated a single and plain profile, not meta-profiles like !dev
, nor multi-profile documents).