spring cloud(六、rabbitmq)
阿新 • • 發佈:2018-11-21
用Spring Cloud Bus實現通知微服務架構的配置檔案的更改
1.安裝好rabbitMq並啟動
2.修改config-client專案,引入spring-cloud-starter-bus-amqp和spring-boot-starter-actuator依賴
3.修改bootstrap.properties
加上:
spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest spring.cloud.bus.enabled=true spring.cloud.bus.trace.enabled=true management.endpoints.web.exposure.include=bus-refresh
4.啟動類加上註解:@EnableDiscoveryClient
6.修改foo的值,用post請求訪問http://localhost:8881/actuator/bus-refresh,再訪問http://localhost:8881/hi