1.手动刷新
访问/bus/refresh接口config-server把更新的配置信息发送到rabbitmq里面
1.server端导入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
2.配置yml,暴露所有终端
management:
endpoints:
web:
exposure:
include: "*"
2.client端导入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
3.类上加注解@RefreshScope
4.访问config-server的/actuator/bus-refresh,配置刷新
2.自动刷新
1.使用内网穿透,暴露本机ip在公网上
2.webhook配置路由/monitor
3.配置Content type 为application/json