内容简介:待刷新的配置属性所在的类上添加了这样,修改参考文档:
配置刷新三要素
spring-boot-starter-actuator /actuator/refresh
management:
endpoints:
web:
exposure:
include: refresh
待刷新的配置属性所在的类上添加了 @RefreshScope
注解 ,例如:
@RestController
@RefreshScope
public class ConfigClientController {
@Value("${profile}")
private String profile;
@GetMapping("/profile")
public String hello() {
return this.profile;
}
}
这样,修改 profile
配置后,只需向应用的 /actuator/refresh
端点发送POST请求,即可刷新该属性。例如:
curl -X POST http://localhost:8081/actuator/refresh
自动刷新、批量刷新-Spring Cloud Bus
参考文档: http://www.itmuch.com/spring-cloud/spring-cloud-bus-auto-refresh-configuration/
引入Cloud Bus后,就会多一个 /actuator/bus-refresh
端点。
本文链接 : 跟我学Spring Cloud(Finchley版)-22-Spring Cloud Config-配置动态刷新
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- springcloud 配置文件管理动态刷新
- Nacos 自动刷新配置如何实现的?
- nginx配置 vue打包后的项目 解决刷新页面404问题|nginx配置多端访问
- 原 荐 白话SpringCloud | 第八章:分布式配置中心的服务化及动态刷新
- ApiBoot v2.2.6 发布,新增配置客户端 OAuth2 刷新令牌过期时间
- Swift iOS : 上拉刷新或者下拉刷新
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Flash PHP实用开发技术
Steve Webster著、王黎译 / 王黎 / 清华大学出版社 / 2002-3 / 39.00元
本书将介绍服务器端脚本所提供的各种可能的操作方案,帮助读者掌握设计数据库集成程序和高端应用程序的知识。一起来看看 《Flash PHP实用开发技术》 这本书的介绍吧!