Spring Cloud Consul Endpoint / Updates

I am using Spring Cloud Consul for distributed configuration with Consul and everything is going well. The entire configuration is currently and successfully read from the Consul server when the application starts. But I can’t reload this configuration for my application when some Consul data has changed because there is no /refresh endpoint. But here it says: "Sending an HTTP POST to update / reboot will reload the configuration." As far as I understand, this should be like for Spring Cloud Config Client, but it is not. What did I miss?

+5
source share
2 answers

You need to enable spring actuator

  <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 
+7
source

Or add @RefreshScope to your bean, e.g.

 @Component @RefreshScope public class MyConsulConfig { @Value("${consul.base.url}") private String baseUrl; } 
0
source

Source: https://habr.com/ru/post/1246166/


All Articles