springcloud-config配置中心实现动态刷新-手动版

问题:在运维人员修改外部配置文件后(githun远程库config中的配置文件),config服务端能随之变化而变化,而config客户端并不会刷新?
目的:避免服务重启
1、在bootstrap.yml配置文件添加
–bootstrap.yml优先级高于application.yml
springcloud-config配置中心实现动态刷新-手动版_第1张图片
2、在controller业务类中添加注解 @RefreshScope
springcloud-config配置中心实现动态刷新-手动版_第2张图片
3、通过curl发送一个POST请求
curl -X POST “http://localhost:3355/actuator/refresh”
在这里插入图片描述
测试通过即可

你可能感兴趣的:(springboot,config)