Spring cloud 在Spring云配置客户端中启用/bus/refresh端点

Spring cloud 在Spring云配置客户端中启用/bus/refresh端点,spring-cloud,spring-cloud-config,spring-cloud-bus,Spring Cloud,Spring Cloud Config,Spring Cloud Bus,我的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

我的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)
在我的SpringCloudConfigServer应用程序中,我禁用了这些端点,即设置为false

endpoints.spring.cloud.bus.refresh.enabled: false
endpoints.spring.cloud.bus.env.enabled: false

并观察到在Spring启动期间,
/bus/*
端点未被启用。

您是否将客户端的url映射到了
/bus/refresh
?我相信默认情况下它会映射到
/refresh

您也可以尝试向客户端应用发送POST请求,地址为:

curl -X POST http://server:port/refresh
我还相信您可能不需要
springcloudstarterstreamrabbit
依赖项,只需要
springcloudstarterbus-amqp


顺便说一句,我在上发布了一篇详细的工作演示文章:这可能会帮助您作为一个起点。

查看代码后,发现
spring.cloud.config.bus.enabled
被设置为false或覆盖

我在Spring Boot的顶部使用企业框架jar;它在
bootstrap.yml
中启用了
spring.cloud.config.bus.
作为true,但这被配置服务器属性文件覆盖,即git属性文件存储库的值为false,并给出了首选项

localhost:<port>/env
下图spring
env
rest资源用于确保此属性的精确值

localhost:<port>/env/spring.cloud.config.bus.enabled
localhost:/env/spring.cloud.config.bus.enabled

使用我截至2018/04/12的调查结果更新此问题

/执行器/总线刷新是从配置服务器开始的方式

在application.properties中:

spring.cloud.bus.enabled=true
management.endpoints.web.exposure.include=bus-refresh
例如: curl-X柱

通知所有已注册的客户端更新其配置


我发现的大多数现有文章都没有这一点,但我设法找到了最简单的一篇文章,它基于反复试验和这里的一些解决方案。

我面临着完全相同的问题。我的意见如下: 我纠正了这一点,RabbitMQ/AMQP maven依赖性是我的主要问题

我的micro service&springCloudConfigServer模块正在使用以下内容:2.2.4.RELEASE-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>
        -->
management.endpoints.web.exposure.include=bus-refresh
这个URL对我有用: 而不是:/bus/refresh或/bus/env

1) 您需要在micro服务模块和springCloudConfigServer模块中同时具有spring启动程序执行器spring cloud启动程序总线amqpmaven依赖项

2) 在我的微服务模块中,当我使用spring rabbitmaven dep.&当我尝试执行URL:/actuator/bus refresh时,它总是失败,错误响应404!出于某种原因

3) 然后,我将我的微服务pom文件从SpringRabbit更新为SpringCloudStarterBusAMQP,并再次尝试相同的URL。成功了!我的推论很简单。 只是因为某种原因,“SpringRabbit”不支持执行器/总线刷新。(我是在做了相同的尝试和错误后了解到这一点的)

希望这对你有帮助。
如果没有,您可以参考&

是否导入bom表?“未启用”是什么意思?你打了它,得到了404什么?谢谢[,问题是resolved@ootero将客户端url映射到/exactor/bus是什么意思-refresh@legend应用程序使用Spring Cloud配置客户端依赖项。另外,我想我提到了/actuator/refresh而不是/actuator/bus refresh。根据Spring Cloid的David Syer,这不应该是。这是一个将在7月份某个时候修复的bug希望这种情况有所改变。我使用了您上面提到的属性,这帮了我半路。与此同时,我还将我的微服务模块中的maven依赖项从spring rabbit更新为spring cloud starter bus amqp。我在下面提供了我的答案/解决方案,仅针对最新的spring版本和发行版。谢谢,Chad。
management.endpoints.web.exposure.include=bus-refresh