【问题标题】:Spring Boot Application run failedSpring Boot 应用程序运行失败
【发布时间】:2019-07-13 00:23:09
【问题描述】:
2019-07-12 17:32:57.619  WARN 24158 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/web/debug/DebugFilter

2019-07-12 17:32:57.639 ERROR 24158 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/web/debug/DebugFilter

这是什么错误?我找不到它的任何来源。

【问题讨论】:

  • 如果你检查java.lang.NoClassDefFoundError: org/springframework/security/web/debug/DebugFilter这一行,你会发现它在你的项目中找不到这个类。你确定你的类路径中有 jar spring-security-web 吗?试试这个链接来获取 jar,在 maven 或 gradle 中使用:[mvnrepository.com/artifact/org.springframework.security/…]。这很可能会解决问题。
  • 类丢失...

标签: java spring spring-boot


【解决方案1】:

项目缺少依赖项。在您的 pom.xml 中添加以下依赖项

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
</dependency>

【讨论】:

  • 问题已解决。所有 spring-security 依赖版本都需要匹配。为什么会这样呢?谢谢大家。
猜你喜欢
  • 2020-10-26
  • 1970-01-01
  • 2020-05-14
  • 2021-11-11
  • 2018-11-23
  • 2019-04-01
  • 1970-01-01
  • 2017-05-12
相关资源
最近更新 更多