当前位置: 代码迷 >> 综合 >> SpringCloud Bus自动刷新配置
  详细解决方案

SpringCloud Bus自动刷新配置

热度:96   发布时间:2024-02-01 10:44:30.0

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