简体   繁体   中英

spring cloud config client config refresh not working

When using spring cloud config client , I try to update my app config via update application.properites file. But it dose not work.

What i already try : update config file , and commit to git;

Dose anyone know what is going on ? I try to test it it result in controller String value like below:

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

And i already add @RefreshScope in my client side config; Did I miss something ?

I finally work work why. It did not work because I put @RefreshScope in a wrong place. If we want it to work work , we need to place @RefreshScope to the Configuration Class that we want to update value . So , in my case , I need to place it to the Controller class that using this bean value.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM