Enabling /bus/refresh endpoint in Spring Cloud Config Client

HHS picture HHS · May 12, 2017 · Viewed 10.1k times · Source

My Spring Cloud Config Client has dependency to spring.cloud.starter.bus.amqp, but it is still not enabling /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")

I have these dependencies in my config client application, but still not enabling /bus/refresh, /bus/env.

Please let me know what am I missing in my client application.

Note:

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

I have tried setting up these indicators in application.yml or application.properties as these are used by BusAutoConfiguration, to enable /bus/* endpoints.

@ConditionalOnProperty(value = "endpoints.spring.cloud.bus.refresh.enabled", matchIfMissing = true)

In my Spring Cloud Config Server application I have disabled these endpoints, i.e., set to false

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

and observed that during Spring Boot startup /bus/* endpoints are not being enabled.

Answer

ootero picture ootero · May 15, 2017

Did you map client's url to /bus/refresh? I believe it's mapped to /refresh by default.

You could also try sending a POST request to client app at:

curl -X POST http://server:port/refresh

I also believe you might not need spring-cloud-starter-stream-rabbit dependency, just spring-cloud-starter-bus-amqp.

BTW I published a detailed post with working demo at: Refreshable Configuration using Spring Cloud Config Server, Spring Cloud Bus, RabbitMQ and Git that might help you as a starting point.