Skip to content

Profiles from include profile property take precedence over active profile property #13513

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

Closed
vivekasingh opened this issue Jun 18, 2018 · 1 comment
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@vivekasingh
Copy link

Hi

I have observed that starting from spring boot 2.0.2, its giving higher priority to included profiles over active profile.

I am aware about #13151 but that did not fix the issue I am running into.

I my case I have a bootstrap.yml file which pulls configurations from config server. The bootstrap.yml file also defines "spring.profiles.include" to include profiles. To activate a profile I am passing "spring.profiles.active" as jvm startup argument.

I am attaching a sample project to demonstrate the issue, for simplicity I did not specify spring cloud config sever properties and reading both bootstrap.yml & application.yml from classpath.

  1. bootstrap.yml:
spring:
  profiles:
    include: shared_features
  application:
    name: profiledemo
  1. application.yml:
a_sample_key: global_feature_value

---
spring:
  profiles: shared_features

a_sample_key: shared_feature_value
---
spring:
  profiles: development

a_sample_key: dev_feature_value

I have used a command line runner to log this property on console and using bootRun which also set -Dspring.profiles.active=development.

With Spring boot 2.0.1 & Finchley.RC1:
a_sample_key: dev_feature_value // Which is what I expect, its giving me the property from active profile

With Spring boot 2.0.3 & Finchley.RC2:
a_sample_key: shared_feature_value // Which is not correct, its returning me value from included profile

profiledemo.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 18, 2018
@mbhave mbhave added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 18, 2018
@mbhave mbhave added this to the 2.0.x milestone Jun 18, 2018
@mbhave mbhave self-assigned this Jun 18, 2018
@mbhave mbhave closed this as completed in 87680b4 Jun 19, 2018
@mbhave mbhave modified the milestones: 2.0.x, 2.0.4 Jun 19, 2018
@mbhave mbhave changed the title Different profile precedence introduced in Spring Boot 2.0.2 & 2.0.3 when including profile through bootstrap.yml Profiles from include profile property take precedence over active profile property Jun 19, 2018
@vivekasingh
Copy link
Author

@philwebb, @mbhave I still see similar issue when using config server and loading external github properties. Created #13965 with details and a sample project to replicate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants