I'm on my way to setup Spring Cloud Config to allow one of our applications to change some configuration properties while runtime. As for now it is only one application to be managed by the Spring Config Server and I want to keep deployment simple, I would like to deploy the Config Server and the Application as one. As far as I got this is supported as "Embedding the Config Server".
To get this running, I used https://spring.io/guides/gs/centralized-configuration as base to setup a separated Config Server and a client. I also setup a config repository in file:/Users/mibutec/projects/config-repo containing
message=Hello, Mibutec
This setup works fine, and when calling curl localhost:8888/message
I see my message Hello, Mibutec
. Everything fine!
Now I tried to get the Config Server also running within the client application.
I changed the application.properties of the client application as follows:
server.port=8888
spring.application.name=a-bootiful-client
management.endpoints.web.exposure.include=*
# spring.config.import=http://localhost:8888/
spring.profiles.active=composite
spring.cloud.config.server.composite[0].type=git
spring.cloud.config.server.composite[0].uri=file:/Users/mibutec/projects/config-repo
spring.cloud.config.server.bootstrap=true
I enabled the Config Server by adding @EnableConfigServer
to the Main-class.
I didn't do anything with some bootstrap.properties
, as I goy this is only required Spring Boot < 2.4 and I'm beyond.
However, I don't get the client to update it's properties. Whenever I call localhost:8888/message
I see my message Hello default
The Config Server itself seems to work fine: Calling curl localhost:8888/a-bootful-client-composite.yml
returns
message: Hello, Mibutec
I also tried to refresh the application via actuator, which also does not change anything.
So my questions:
- Did I get the idea of "Embedding the Config Server" right? Should it be able to configure my application directly?
- Is it correct to remove spring.config.import from the client-config? I got it is replaced by
spring.cloud.config.server.bootstrap
. I also tried to configure it to the address of my internal Config Server, but than I get while startup Config data location 'http://localhost:8888/' does not exist which makes sense as the port is seems not started yet.
Comment From: ryanjbaxter
Because the configuration needs to be fetched during bootstrap in order to configure the config server you need to take the properties that you have in application.properties
and put them in bootstrap.properties
and include spring-cloud-starter-bootstrap
on the application classpath.
Comment From: spring-cloud-issues
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.
Comment From: spring-cloud-issues
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.