在學習Spring cloud config模塊時,通常都是跟着官網的Centralized Configuration | quick-start作一遍.html
但在下面這步的時候,出現問題了:git
configuration-client/src/main/resources/bootstrap.properties
spring.application.name=a-bootiful-client
# N.B. this is the default:
spring.cloud.config.uri=http://localhost:8888
management.security.enabled=false
複製代碼
最後一句出現了紅線,也就是這個無效了。web
若是你無視這個問題,繼續往下作:spring
http://localhost:8888/a-bootiful-client/default
來驗證config服務器已經知道了改變,你須要調用
refresh
方法來強制客戶端去獲取新的值.......你能夠經過使用
post
方法去請求
http://localhost:8888/refresh
來調用
refresh
方法,而後訪問
http://localhost:8080/message
來驗證是否生效。
然而當你使用post
方法去請求http://localhost:8888/refresh
時,返回的404。bootstrap
在docs.spring.io | 50.2 Exposing Endpoints這個文檔講到了:bash
management.security.enabled=false
被刪除的緣由
這裏就不貼表的截圖了,能夠點擊上面的鏈接詳細查看,會發現除了health和info兩個支持web訪問外,其餘的默認不支持web訪問。服務器
在bootstrap.properties文件中添加下面的代碼 management.endpoints.web.exposure.include=*
app
暴露所有endpoints,你也能夠指定須要暴露的endpoints。ide