springboot2.0 management.security.enabled无效

在1.5.x版本中通过management.security.enabled=false来暴露所有端点

在使用springcloud的时候,如果基于springboot2的版本的配置中心,无法使用SVN的刷新功能(修改配置后不需要重启服务器),那么需要重新按照新版本的要求进行配置

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

同时在控制层需要加上相应注解

@RefreshScope // 使用该注解的类,会在接到SpringCloud配置中心配置刷新的时候,自动将新的配置更新到该类对应的字段中。
然后用post请求去访问http://localhost:8002/refresh

原文地址:https://www.cnblogs.com/xc-chejj/p/11321737.html