Search code examples
javaspringspring-bootspring-cloud

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 ?


Solution

  • 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;
    }