As described at here, bootstrap-xxx.yml is loaded with spring.profiles.active=xxx only.
But it does NOT loaded with spring.profiles.include=xxx ( spring.profiles.include comes from Spring Boot).
Sometimes I prefer to use spring.profiles.include to map an other profile.
It would become more useful if spring.profiles.include were supported.
has this been implemented?
@indraneelb1903 generally speaking, if an issue is open, it has not been implemented.
waiting for it ...
Hi, @jiang-wei @indraneelb1903 @ikeyat I think this issue has been solved by the following commit , would you please check it?
https://github.com/spring-projects/spring-boot/commit/378c4c9535a5fb52f981e111c402902a064b8409
I used Finchley.SR2, it can work, but after update to Finchley.SR3, this issue happened again.
And I just pass "--spring.profiles.include=git" by command args to fixed it as a temp resolution.
Hi @yuanjinyong , I tried Finchley.SR3, and it seems it works correctly.
you can see the sample project here, please use the spring-cloud-config_issue_604 branch.
in bootstrap.yml
spring:
profiles:
include: git
foo.bar: this is foo.bar value in bootstrap.yml
in bootstrap-git.yml
foo.bar: this is foo.bar value in bootstrap-git.yml
In application, we can see from the output from the following line , the value of 'foo.bar' is the one in bootstrap-git.yml.
Would please provide more information on your usecase or provide a simple project to reproduce the issue ?
This issue is cause by jasypt-spring-boot have conflict with spring-cloud-context-2.0.3.RELEASE.
In spring-cloud-context-2.0.3.RELEASE, have the follow change:
org\springframework\cloud\bootstrapBootstrapApplicationListener.java
public void add(PropertySource<?> source) {
if (source instanceof EnumerablePropertySource
&& !this.names.contains(source.getName())) {
this.sources.addPropertySource(source);
this.names.add(source.getName());
}
}
to
public void add(PropertySource<?> source) {
// Only add map property sources added by boot, see gh-476
if (source instanceof OriginTrackedMapPropertySource
&& !this.names.contains(source.getName())) {
this.sources.addPropertySource(source);
this.names.add(source.getName());
}
}
And after use jasypt, the "PropertySource> source" instance will be "com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableMapPropertySourceWrapper", it is an intance of EnumerablePropertySource, but not an intance of OriginTrackedMapPropertySource.
OriginTrackedMapPropertySource is a final class, it can not be extended by EncryptableMapPropertySourceWrapper.
https://github.com/ulisesbocchio/jasypt-spring-boot/issues/133
@spencergibb As this issue was already solved in Spring Boot, I think it can be closed.
What do you think?
I'd like to hear from someone else if they can try snapshots of boot.
@yuanjinyong, @ikeyat, @indraneelb1903 or @jiang-wei?
As OriginTrackedMapPropertySource is a final class, it can not be extended by EncryptableMapPropertySourceWrapper, can change the code as following?
if (source instanceof OriginTrackedMapPropertySource
to
if (source instanceof MapPropertySource
@yuanjinyong, the change you suggested is what it was originally and it caused us problems. You can always delegate rather than extend.
@yuanjinyong, the change you suggested is what it was originally and it caused us problems. You can always delegate rather than extend.
originally is following:
if (source instanceof EnumerablePropertySource
not:
if (source instanceof MapPropertySource
Most helpful comment
@indraneelb1903 generally speaking, if an issue is open, it has not been implemented.