在使用SpringCloud的config时,希望通过@RefreshScope实现动态更新配置信息,但是却发现没有/refresh端口。下面展示解决方案。
开发环境:Spring2.2.7.RELEASE
1.添加actuator依赖
<!--actuator-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2. 开启指定端点
management.endpoints.web.exposure.include=refresh
本文介绍如何在SpringCloud中使用@RefreshScope实现配置信息的动态更新。通过添加actuator依赖,开启refresh端点,并使用POST方式访问/actuator/refresh路径,可实现配置的实时刷新。

被折叠的 条评论
为什么被折叠?



