You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级spring-boot-actuator-autoconfigure后应用启动失败求助

问题原因

Spring Boot 2.7.11版本中,org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration已不再是自动配置类(该类的职责在版本迭代中被重构或由其他机制接管),因此在@SpringBootApplication的exclude参数中指定该类会触发IllegalStateException错误。

解决方案
  1. 移除无效的排除类
    修改Application.java中的@SpringBootApplication注解,删除ManagementWebSecurityAutoConfiguration.class:

    @SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
    
  2. 通过配置属性替代类排除(如果需要禁用管理端点安全)
    若你原本排除该类是为了关闭管理端点的安全校验,在2.7.x版本中推荐使用配置属性实现:
    在application.properties中添加:

    # 关闭管理端点的安全校验
    management.security.enabled=false
    # 若需要完全禁用Spring Security(根据实际需求选择)
    # spring.security.enabled=false
    

    若需要更细粒度的端点权限控制,可根据Spring Boot 2.7.x的配置规范调整相关属性。

内容的提问来源于stack exchange,提问作者Ciby

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 09:20:20