-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Migrating out of spring.profiles.include into spring.profiles.group #24172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening the issue @blacelle. We suspected that there would be a few users with complex setups like yours that unfortunately will find the upgrade difficult. In the short-term, you can try setting
Yes, you can define multiple groups, so you should be able to do something like this: spring:
profiles:
group:
prod: prod-db, prod-queue, prod-common
prod-db: common-db
prod-queue: common-queue
This means that you can use
Yes, you can define your profile groups in a distinct file and import it if you want to. For example you can have an spring:
config:
import: classpath:profile-groups.yaml Then have a
This would unfortunately negate most of the benefit that we're trying to achieve with the changes. We're really trying to make our own code much more robust and remove as much complexity as possible. Please let us know if the profile groups feature works for you. If not, perhaps you can share a sample project that shows your current setup and we can work out if there's something else we can do. |
I completely catch the point of this evolution. Still, I'm quite disappointed as I was very happy of leveraging About:
I supposed it would be quite straightforward if considering only single-simple profiles (just like I may end writing my own Also, what about warning/failing if On my side, I'm pretty sure I'll succeed to comply with the new standard. Thanks for the feedback. Feel free to close. |
You should get an exception for that already. Thinking some more about your use-case. You might be able to use an |
@philwebb In https://docs.spring.io/spring-boot/docs/2.4.0/reference/htmlsingle/#spring.profiles.include, the lack of impact related to discussed change mislead me in the first step of our migration. I suppose some note may be added there.
I definitely did not get one. Especially in unit-tests relying on The source of the test is:
Hope it helps. |
@blacelle Can you share a small project that shows that full test? I think I need to see the contents of the |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
I tried, if i have the same properties in |
@blling It's hard to tell without a sample. If you properties are all in one file then it might be the document order. |
Uh oh!
There was an error while loading. Please reload this page.
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 onspring.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
toThanks 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
The new group features looks great to ensure
prod
triggersprod-db
,prod-queue
andprod-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 overcommon-db
andprod-common
, and aprod-queue
groups overcommon-queue
andprod-common
? I guess so.To confirm what it would look like:
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
. Doesnot in a profile-specific document
refers to file being imported throughspring.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).The text was updated successfully, but these errors were encountered: