springBoot: “management.security.enabled=false”无效

Problem:

Spring Boot 2.x中的“management.security.enabled=false”无效问题!

Solution:

无效的原因是被弃用!

新的配置为:

management.endpoints.web.exposure.include=*

注:
同时要将SpringSecurity注释掉,或者更改其“configure”方法如下:

protected void configure(HttpSecurity http) throws Exception {  // 重写configure方法

    http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();

}

尤其需要注意的是:springboot2.0后,挂载点发生变化!所有节点都改挂在/actuator上了。

即,如:
   http://localhost:8080/actuator/
当然,也可通过更改相关的配置修改挂载点。
还有,application.properties内的配置为:

设置关闭安全限制

management.endpoints.web.exposure.include=*

详情请参考:

SpringBoot2.0官方迁移:

http://blog.didispace.com/Spring-Boot-2.0-Migration-Guide/

发布了54 篇原创文章 · 获赞 4 · 访问量 3587

猜你喜欢

转载自blog.csdn.net/qq_40994260/article/details/102990625