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?
Spring Cloud Consul /refresh endpoint missing
Asked Answered
You need to include the spring boot actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Or add @RefreshScope
on your bean for e.g.
@Component
@RefreshScope
public class MyConsulConfig {
@Value("${consul.base.url}")
private String baseUrl;
}
true..but it will refresh the values without a need to invoke /refresh? –
Haemo
Consul has a config watch that will refresh when values change –
Allsun
© 2022 - 2024 — McMap. All rights reserved.