Open mibutec opened 1 month ago
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.
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
This setup works fine, and when calling
curl localhost:8888/message
I see my messageHello, 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:
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 messageHello default
The Config Server itself seems to work fine: Calling
curl localhost:8888/a-bootful-client-composite.yml
returnsI also tried to refresh the application via actuator, which also does not change anything.
So my questions:
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.