management . security .enabled=false无效
一、在1.5.x版本中通过management.security.enabled=false来暴露所有端点
具体配置类:
1 |
org.springframework.boot.actuate.autoconfigure.ManagementServerProperties$Security |
二、切换 SpringBoot 版本为2.x 使用IDE的搜索功能
找到类ManagementServerProperties,发现Security内部类已经被删除
三、去官网查看2.0暴露端点的方式
方式1:
1 2 3 4 5 |
# 启用端点 env management.endpoint.env.enabled= true
# 暴露端点 env 配置多个,隔开 management.endpoints.web.exposure.include=env |
方式2:
方式1中的暴露方式需要一个一个去开启需要暴露的端点,方式2直接开启和暴露所有端点
1 |
management.endpoints.web.exposure.include=* |
注意在使用Http访问端点时,需要加上默认/actuator 前缀
management.security.enabled 过时
在Spring boot 2.0中
1 |
management.security.enabled= true |
或
1 2 3 |
management: security: enabled: true |
可以采用
1 |
management.endpoints.web.exposure.include= |
代替的全部放开请使用*,或把需要开放的接口端点使用[,]隔开,如:env,health。
yaml 的配置*请加上["](引号)如下
1 2 3 4 5 |
management: endpoints: web: exposure: include: "*" |
更多配置信息请参考 spring-boot endpoints
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。
原文链接:https://blog.csdn.net/qq_27385301/article/details/82899303
查看更多关于SpringBoot2.x中management.security.enabled=false无效的的详细内容...