Spring 安全框架 2.6.4 出现错误(getInterfaceMethodIfPossible 的 NoSuchMethodError)
更新到 Spring boot 2.6.4 后,当我尝试调用我的其余控制器时,我收到此错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through method 'setFilterChainProxySecurityConfigurer' parameter 1; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.reflect.Method org.springframework.util.ClassUtils.getInterfaceMethodIfPossible(java.lang.reflect.Method, java.lang.Class)'
直到 2.6.3 才会出现问题
我尝试添加:
@EnableWebSecurity
@EnableWebMvc
到我的 WebSecurityConfigurerAdapter 类,但这不会产生任何差异
After the update to Spring boot 2.6.4, I get this error while i try to call my rest controllers:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Unsatisfied dependency expressed through method 'setFilterChainProxySecurityConfigurer' parameter 1; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.reflect.Method org.springframework.util.ClassUtils.getInterfaceMethodIfPossible(java.lang.reflect.Method, java.lang.Class)'
The problem does not occur until 2.6.3
I tried to add:
@EnableWebSecurity
@EnableWebMvc
To my WebSecurityConfigurerAdapter class, but that produces no difference
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Spring Boot 2.6.4 应与 Spring Framework 5.3.16 一起使用,但您使用的是早期版本。您需要更新 Maven 或 Gradle 配置来纠正此问题。我建议使用 Spring Boot 的依赖管理来保持版本同步。
Spring Boot 2.6.4 should be used with Spring Framework 5.3.16 but you are using an earlier version. You need to update your Maven or Gradle configuration to correct this. I’d recommend using Spring Boot’s dependency management to keep versions in sync.
将 spring-core 版本升级到 5.3.16 解决了这个问题。
Upgrading spring-core version to 5.3.16 solved this issue.