Spring Cloud Consul /refresh endpoint missing
Asked Answered
I

2

5

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?

Inveigh answered 31/3, 2016 at 15:43 Comment(0)
A
7

You need to include the spring boot actuator

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
Allsun answered 31/3, 2016 at 17:44 Comment(0)
H
0

Or add @RefreshScope on your bean for e.g.

@Component
@RefreshScope
public class MyConsulConfig  {

@Value("${consul.base.url}")
private String baseUrl;
}
Haemo answered 14/11, 2017 at 18:58 Comment(2)
true..but it will refresh the values without a need to invoke /refresh?Haemo
Consul has a config watch that will refresh when values changeAllsun

© 2022 - 2024 — McMap. All rights reserved.