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


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。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM