SpringCloudBus消息总线动态更新配置注意事项

要在controller上加@RefreshScope注解,之前没效果是把这注解写到引导类上了,小记。

@RestController
@RequestMapping("")
@RefreshScope
public class ConfigController {
    @Value("${foo}")
    private String foo;

    @RequestMapping("/getfoo")
    public String getFoo(){
        return foo;
    }
}

 

你可能感兴趣的:(Spring,Cloud)