spring引导自动配置应用程序启动失败

swvgeqrz  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(374)

我已经构建了自己的启动程序,自动配置步骤因依赖冲突而失败。
这些是我的初学者和上游项目正在使用的spring引导版本
'spring boot gradle plugin',版本2.1.8.release
'spring boot autoconfigure',版本:'2.4.1'


***************************

APPLICATION FAILED TO START

***************************

Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
    org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.lambda$addResourceHandlers$0(W
ebMvcAutoConfiguration.java:411)
The following method did not exist:
    'org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration org.springframework.web.servlet.config.annotation.Re
sourceHandlerRegistration.addResourceLocations(org.springframework.core.io.Resource[])'
The method's class, org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration, is available from the following loca
tions:
    jar:file:/opt/eureka/app.jar!/BOOT-INF/lib/spring-webmvc-5.3.2.jar!/org/springframework/web/servlet/config/annotation/ResourceHandl
erRegistration.class
The class hierarchy was loaded from the following locations:
    org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration: jar:file:/opt/eureka/app.jar!/BOOT-INF/lib/spring-we
bmvc-5.3.2.jar!/
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.web.servlet.config.an
notation.ResourceHandlerRegistration
mgdq6dx1

mgdq6dx11#

从您的日志中,我看到两个可能的问题之一:
您可以在某个地方将spring-webmvc-5.3.2重写为更高或更低的版本
初学者代码中有问题(如果它配置了webmvc)
尝试 mvn dependency:tree 或者 gradle dependencies 探索依赖关系。附上你的启动码。

相关问题