java 创建名为“webMvcRequestHandlerProvider”的Bean时出错

ippsafx7  于 2022-10-30  发布在  Java
关注(0)|答案(1)|浏览(1039)

我是Spring“things”的新用户,我使用的是以下版本:

spring-boot-starter-parent
1.5.3-RELEASE

我对pom.xml有依赖性

  • 2.8.0软件包
  • 我是一个软件工程师,我是一个软件工程师。

我认为这产生了下面的错误,但我不知道为什么。
可以帮我吗?

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcRequestHandlerProvider' defined in URL [jar:file:/C:/Users/tjoel/.m2/repository/io/springfox/springfox-spring-web/2.8.0/springfox-spring-web-`enter code here`2.8.0.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
krcsximq

krcsximq1#

根据this issue
它失败了,因为您有多个Spring上下文在运行。您可能需要尝试删除/添加@Configuration和@EnableWebMvc配置

相关问题