HHS*_*HHS 2 spring-cloud spring-cloud-config spring-cloud-bus
我的 Spring Cloud Config Client 依赖于spring.cloud.starter.bus.amqp,但它仍然没有启用/bus/refresh endpoint
build.gradle
compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit:1.1.3.RELEASE")
compile("org.springframework.cloud:spring-cloud-starter-bus-amqp:1.2.2.RELEASE")
Run Code Online (Sandbox Code Playgroud)
我的配置客户端应用程序中有这些依赖项,但仍然没有启用/bus/refresh, /bus/env.
请让我知道我的客户端应用程序中缺少什么。
笔记:
spring.cloud.bus.refresh.enabled: true
spring.cloud.bus.env.enabled: true
endpoints.spring.cloud.bus.refresh.enabled: true
endpoints.spring.cloud.bus.env.enabled: true
Run Code Online (Sandbox Code Playgroud)
我已尝试在 , 中application.yml或application.properties在 , 使用时设置这些指标BusAutoConfiguration以启用/bus/*端点。
@ConditionalOnProperty(value = "endpoints.spring.cloud.bus.refresh.enabled", matchIfMissing = true)
Run Code Online (Sandbox Code Playgroud)
在我的 Spring Cloud Config Server 应用程序中,我禁用了这些端点,即设置为 false
endpoints.spring.cloud.bus.refresh.enabled: false
endpoints.spring.cloud.bus.env.enabled: false
Run Code Online (Sandbox Code Playgroud)
并观察到在 Spring Boot 启动期间/bus/*没有启用端点。
您是否将客户的网址映射到/bus/refresh?我相信它/refresh默认映射到。
您还可以尝试在以下位置向客户端应用程序发送 POST 请求:
curl -X POST http://server:port/refresh
Run Code Online (Sandbox Code Playgroud)
我也相信你可能不需要spring-cloud-starter-stream-rabbit依赖,只需要spring-cloud-starter-bus-amqp.
顺便说一句,我在以下位置发布了一篇详细的工作演示文章:使用 Spring Cloud Config Server、Spring Cloud Bus、RabbitMQ 和 Git 的可刷新配置,这可能会帮助您作为起点。
用我截至 2018/04/12 的发现更新这个问题
/actuator/bus-refresh 是从配置服务器进入的方式。
在您的 application.properties 中:
spring.cloud.bus.enabled=true
management.endpoints.web.exposure.include=bus-refresh
Run Code Online (Sandbox Code Playgroud)
示例:curl -X POST http://localhost:8080/actuator/bus-refresh
通知所有注册客户端更新其配置。
我发现的大多数现有文章都没有这个,但我设法根据这里的尝试和错误以及解决方案的花絮找到了最简单的一篇。
| 归档时间: |
|
| 查看次数: |
9004 次 |
| 最近记录: |