spring 云配置客户端配置刷新不起作用

spring cloud config client config refresh not working

当使用 spring 云配置客户端时,我尝试通过更新 application.properites 文件来更新我的应用程序配置。但它不起作用。

我已经尝试过的:更新配置文件,并提交 git;

有谁知道发生了什么事吗? 我尝试对其进行测试,结果控制器字符串值如下所示:

@Value("${my-name}")
private String name;

而且我已经在我的客户端配置中添加了@RefreshScope; 我错过了什么吗?

我终于上班了,为什么。 它没有用,因为我把@RefreshScope 放在了错误的地方。 如果我们希望它正常工作,我们需要将 @RefreshScope 放置到我们要更新值的配置 Class 中。 因此,在我的例子中,我需要将它放置到使用此 bean 值的控制器 class。

@RefreshScope
public class ClientController {
    @Value("${my-name}")
    private String name;
}