1. springcloud1.5.x的消息總線配置是
# RabbitMq的地址、端口,用戶名、密碼 spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest # 保證調用 /bus/refresh的時候不需要驗證 management.security.enabled=false
configServer的啟動類加上注解@RefreshScope
configClient的啟動類也加上注解@RefreshScope
修改github上的配置文件之后,打開postman,請求方式是post,地址是http://localhost:8881/bus/refresh,這個端口號是configServer的。
請求成功之后,返回的是空白,此時configClient就能獲取到最新的配置信息。
2. springcloud2.x的消息總線配置是
# RabbitMq的地址、端口,用戶名、密碼 spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest # 刷新配置,在spring boot 2.x 之前1.x的management.security.enabled失效,新的配置為 management.endpoints.web.exposure.include=bus-refresh
configServer的啟動類加上注解@RefreshScope
configClient的啟動類也加上注解@RefreshScope
修改github上的配置文件之后,打開postman,請求方式是post,地址是http://localhost:8881/actuator/bus-refresh,這個端口號是configServer的。
請求成功之后,返回的是空白,此時configClient就能獲取到最新的配置信息。
3. 需要注意的是configClient也要配置RabbiMq。