0%

SpringCloud Actuator

动态刷新配置

pom.xml

1
2
3
4
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

application.yml

1
2
3
4
5
6
7
#关闭安全认证
management:
#refresh接入点显式暴露出来
endpoints:
web:
exposure:
include: refresh,health,info

给需要加载变量的bean上面加载@RefreshScope注解

客户端执行/refresh的时候就会更新此bean下面的变量值

1
curl -X POST http://localhost:7007/actuator/refresh