bootstrap.yml not being respected when establishing property source ordering
See original GitHub issueI’m using version 1.0.0.RC1 of the Spring Cloud stack and I think I’ve run into an issue. The use case is that my configuration server is serving up an application.yml
file that is intended to be the default for my applications. One entry in there is the Tomcat server port:
server:
contextPath: /
port: 8080
useForwardHeaders: true
Normally, I can override the port value either through the command-line, system variable or environment variable. When using the configuration server, that is not happening. I’ve watched things in the debugger and I’ve noticed that when org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration#insertPropertySources
runs through its algorithm to decide the placement of the composite
property source, it consults the remoteProperties
variable. Seeing that, I adjusted my bootstrap.yml
file so that I could convince the algorithm to add the composite
property source to the end of the list instead of the front. As I watched things in the debugger, I realized that the remoteProperties
variable does not consult the bootstrap.yml
file, instead relying on the default values of org.springframework.cloud.bootstrap.config.PropertySourceBootstrapProperties
. I see that the propertySources
list does contain the values of my bootstrap.yml
file so the values are available.
At the end of the day, I want to the ability to override configuration properties fetched from the configuration server with values I’ve specified locally.
If it helps, this is the current contents of my bootstrap.yml
but I’ve tried many combinations to see if I can make things work so the combination below might not be a “legal” combination of values.
spring:
application:
name: example
cloud:
config:
allowOverride: true
failFast: true
overrideNone: true
overrideSystemProperties: true
uri: ${SPRING_CONFIG_URI:http://localhost:2020}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Thanks. I’ve gotten things working. Here is my final solution:
@lowzj Thank you for your reminder, and I set
in remote git repo. It works this time, thanks for your help~