springboot2.0 management.security.enabled無效

在1.5.x版本中經過management.security.enabled=false來暴露全部端點web

在使用springcloud的時候,若是基於springboot2的版本的配置中心,沒法使用SVN的刷新功能(修改配置後不須要重啓服務器),那麼須要從新按照新版本的要求進行配置spring

#yml格式
management:
 endpoints:
  web:
exposure: include: refresh
#properties文件格式
management.endpoints.web.exposure.include=*

同時在控制層須要加上相應註解springboot

@RefreshScope // 使用該註解的類,會在接到SpringCloud配置中心配置刷新的時候,自動將新的配置更新到該類對應的字段中。
而後用post請求去訪問http://localhost:8002/refresh服務器

相關文章
相關標籤/搜索