springcloud2.x之management.security.enabled=false報錯處理

1. springcloud1.5.x的消息總線配置是git

# 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
github

configClient的啓動類也加上註解@RefreshScopeweb

修改github上的配置文件以後,打開postman,請求方式是post,地址是http://localhost:8881/bus/refresh,這個端口號是configServer的。spring

請求成功以後,返回的是空白,此時configClient就能獲取到最新的配置信息。post

2.  springcloud2.x的消息總線配置是spa

# 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
code

configClient的啓動類也加上註解@RefreshScopeblog

修改github上的配置文件以後,打開postman,請求方式是post,地址是http://localhost:8881/actuator/bus-refresh,這個端口號是configServer的。rabbitmq

請求成功以後,返回的是空白,此時configClient就能獲取到最新的配置信息。springcloud

3. 須要注意的是configClient也要配置RabbiMq。

相關文章
相關標籤/搜索