前面写过一篇《Spring Cloud Bus 实现配置实时更新》,是使用配置中心管理配置,使用spring cloud bus来实现实时通知。对于简单的SpringBoot应用,其实不需要使用配置中心也可以实现动态刷新配置。
参考:https://www.cnblogs.com/flying607/p/8459397.html
文章使用springboot版本:2.0.4.RELEASE springcloud版本Finchley.SR1
1. 依赖
需要引入下面三个依赖:
compile('org.springframework.cloud:spring-cloud-starter-config')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-web')
(1)spring-cloud-starter-config是为了实现刷新配置
(2)spring-boot-starter-actuat