-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Different profile precedence introduced in Spring Boot 2.0.2 - include profile now comes after active. #13151
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
See #11380, part of which corrected the ordering of the logged profiles to accurately reflect the order in which they were processed.
Can you please explain why you consider this to be incorrect?
|
Hi, If I explain my use case: I'm deploying in a microservice architecture so I've created a common microservices maven dependency containing spring boot properties I want across all Microservices: Every microservice pulls in this maven dependency & switches on the first profile via When I deploy to the cloud I additionally add the command line argument What's happening now is the cloud profile property is being overridden by the microservice profile and therefore Spring Boot 2.0.2 is quite a large breaking change for me. To illustrate this further if I have a spring boot app with the following properties
and a command line active profile of 'cloud' then Spring Boot <=2.0.1 outputs 'cloudprop' where as 2.0.2 outputs 'microserviceprop' Thanks |
That additional description is very useful. Thank you. |
I seem to be having the exact same issues. Anything in |
assigning myself to review this fix |
I have similar experience too. My services get configuration from config server and the order of profile in http request is changed. |
@philwebb I still the issue with Spring Boot 2.0.3, included profiles are still having higher priority than active profile. I have a bootstrap.yml into classpath which tries to include a profile, and while start the application I am passing the active profile. When properties are fetched from config service, its giving higher priority to profile being included into bootstrap.yml file. |
@vivekasingh I tested with the example given in #13151 (comment). Perhaps it's related to the use of |
on a similar note for Kubernetes ConfigMap, I have the following in bootstrap.yml
Output in console:
I am thinking the ordering should be top down vs bottom up? |
@PaulGobin |
Sorry to be commenting here on an old issue, but my company is using a rather old version of spring-boot (1.5.6.RELEASE) and I'm not sure if this same bug existed in that version or not. I seem to facing the same problem, where a profile included using The problem that I am facing is application-dev.yml
application-main-dev.yml
When I run with What I was hoping that you could answer for me, is
|
@kapad There are a few known issues with property file handling in 1.5.x but we've decided that it's too risky to fix them at this point. On a related note, 1.5.x is EOL in August so you should consider upgrading if possible. |
@philwebb thanks for replying to this really old issue. :) Where can I see the EOL of different spring versions? What you mention is definitely something my team needs to look into, and I would like to link to the official pages and raise the EOL issue to my manager. |
hey @philwebb So I was going through the dependencies of spring-boot 2.0.x and saw that the spring core version that is required is 5.0.x |
After 1st August there will not be a supported version of Spring Boot that depends on Spring Framework 4.3.x. If you want to continue to use a supported version of Spring Boot, you should upgrade to 2.1.x. |
Hi,
Spring Boot 2.0.2 has introduced a different profile precedence when compared to previous versions.
It's very easy to reproduce.
Downgrade the pom to Spring boot 2.0.1 and run again and you will see
The following profiles are active: include,active
which is correct
Spring boot 1.5.13 also gives The following profiles are active: include,active
I'm using Java 8 & MacOS High Sierra.
Thanks
The text was updated successfully, but these errors were encountered: