Issue
I am building an application using Spring Cloud config server as a centralized location for keeping properties file. And I have multiple client applications getting configuration data from config server.
But instead of manually refreshing each client applications to pull latest changes in properties file after commit I'm using Spring cloud bus and Kafka as a message broker so that all changes broadcast to client application. Below are the pom file and properties file.
ConfigServer : pom
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
application.properties :
server.port = 8980
bootstrap.properties :
spring.cloud.bus.enabled=true
spring.cloud.config.server.git.uri= "some path"
Config Client : pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
application.properties :
server.port=8982
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
spring.cloud.stream.kafka.binder.autoAddPartitions=true
spring.cloud.stream.kafka.binder.zkNodes=localhost:2181
spring.cloud.stream.kafka.binder.brokers=localhost:9892
bootstrap.properties :
spring.application.name=department-service
spring.cloud.config.uri=http://localhost:8980
management.security.enabled=false
But after making changes to local git repository file and after commiting when I am trying to pull latest changes using "http://localhost:8982/actuator/bus-refresh" endpoint, it is giving error as below :
{
"timestamp": "2019-01-29T08:49:21.569+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/actuator/bus-refresh"
}
Solution
you need to include "management.endpoints.web.exposure.include=bus-refresh" in your config server application.properties and hit this url
http://localhost:8980/actuator/bus-refresh
Answered By - Dhruv Dhar
Answer Checked By - Katrina (JavaFixing Volunteer)