标签:manage 文件 ppi 自动 @Value getc ntc https inf
修改github的配置文件后, 服务端 ( http://localhost:3344/master/application-dev.yml )能刷新,客户端( http://localhost:3355/configInfo )不能刷新。
做法:cmd执行: curl -X POST http://localhost:3355/actuator/refresh
执行完成再试一下客户端,能自动刷新了。 (这里踩了一些坑)
具体就是在客户端ConfigClient3355中添加以下代码:
yml:
management:
endpoints:
web:
exposure:
include: "*"
java:
@RestController @RefreshScope public class ConfigClientController { @Value("${config.info}") private String configInfo; @RequestMapping("/configInfo") public String getConfigInfo() { return configInfo; } }
代码更新见github:
https://github.com/lulu4pix/springcloud/commit/9410453f934e4a91f14bb793b2a56add0581f551
https://github.com/lulu4pix/springcloud/commit/c208494281620063d3bd49e09be6bc12fc3a5c68
标签:manage 文件 ppi 自动 @Value getc ntc https inf
原文地址:https://www.cnblogs.com/dayanjing/p/14823492.html