I'm using Spring Cloud Consul for Distributed Configuration with Consul and all goes fine. All configuration is currently and successfully read from Consul server on startup of the application. But I can't reload this configuration for my app when some data on Consul changed because there is not /refresh
endpoint. But here says "Sending a HTTP POST to /refresh will cause the configuration to be reloaded." As I understand it should be like for Spring Cloud Config Client but it doesn't. What did I miss?
You can invoke the refresh Actuator endpoint by sending an empty HTTP POST to the client's refresh endpoint: http://localhost:8080/actuator/refresh . Then you can confirm it worked by visting the http://localhost:8080/message endpoint.
The RefreshScope is a bean in the context and has a public refreshAll() method to refresh all beans in the scope by clearing the target cache. The /refresh endpoint exposes this functionality (over HTTP or JMX). To refresh an individual bean by name, there is also a refresh(String) method.
Overriding the Values of Remote Properties If you want to allow your applications to override the remote properties with their own System properties or config files, the remote property source has to grant it permission by setting spring. cloud. config. allowOverride=true (it doesn't work to set this locally).
The @RefreshScope annotation is used to load the configuration properties value from the Config server. Now, add the config server URL in your application. properties file and provide your application name. Note − http://localhost:8888 config server should be run before starting the config client application.
You need to include the spring boot actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With