我的Spring客户机依赖于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")
我的配置客户端应用程序中有这些依赖项,但仍然不能启用/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
我尝试在application.yml
或application.properties
中设置这些指示符,因为BusAutoConfiguration
使用这些指示符来启用/bus/*
端点。
@ConditionalOnProperty(value = "endpoints.spring.cloud.bus.refresh.enabled", matchIfMissing = true)
在应用程序中,我禁用了这些端点,即将其设置为false
endpoints.spring.cloud.bus.refresh.enabled: false
endpoints.spring.cloud.bus.env.enabled: false
并注意到在Spring启动期间,没有启用/bus/*
端点。
发布于 2017-05-15 06:38:08
你把客户的网址映射到/bus/refresh
了吗?我相信默认情况下它是映射到/refresh
的。
您也可以尝试将POST请求发送到客户端应用程序:
curl -X POST http://server:port/refresh
我还相信您可能不需要spring-cloud-starter-stream-rabbit
依赖,只需要spring-cloud-starter-bus-amqp
。
顺便说一句,我在:使用Spring服务器、Spring总线、RabbitMQ和Git的可刷新配置上发表了一篇关于工作演示的详细文章,它可能会帮助您作为一个起点。
发布于 2018-04-12 07:53:08
从2018/04/12年度起,用我的调查结果更新这一问题
/驱动器/总线-刷新是从配置服务器到的方式。
在application.properties中:
spring.cloud.bus.enabled=true
management.endpoints.web.exposure.include=bus-refresh
示例: curl -X POST http://localhost:8080/actuator/bus-refresh
通知所有注册客户更新他们的信任。
我发现的大多数现有文章都没有这一点,但我设法在这里找到了最简单的一篇基于尝试和错误以及一些解决方案的小贴士。
发布于 2020-02-24 11:29:15
我也面临着同样的问题。我的观察如下:我纠正了这个问题,RabbitMQ/AMQP依赖是我的主要问题。
我的微服务和springCloudConfigServer模块使用以下内容:2.2.4.service Hoxton.SR1
我的pom.xml如下:
<!-- Use this! I replaced this maven dep. for following one -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<!-- I was using this maven dep. initially which when replaced by the above solved my issue. Avoid using this for now.
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
-->
我的application.properties / bootstrap.properties如下:
management.endpoints.web.exposure.include=bus-refresh
这个网址适用于我:http://localhost:8080/actuator/bus-refresh和not: /bus/refresh /bus/env
1)在微服务模块和springCloudConfigServer模块中都需要有spring-cloud-starter-bus-amqp和spring-cloud-starter-bus-amqp maven依赖项。
2)在我的微服务模块中,当我使用spring-rabbit maven dep时。&当我尝试执行URL: /致动器/总线刷新时,它总是失败的,错误响应404!出于某种原因。
3)然后,我将我的微服务pom文件从Spring-兔子更新到spring-cloud-starter-bus-amqp,,并再次尝试了相同的URL。啊,真灵!我的推论很简单。只是“春兔”不支持/actuator/bus-refresh是有一定原因的。(我是在做了同样的尝试和错误之后学到的)
https://stackoverflow.com/questions/43946776
复制相似问题