簡體   English   中英

Spring 引導自動配置應用程序啟動失敗

[英]Spring boot autoconfigure application start fails

我已經構建了自己的啟動器,並且自動配置步驟因依賴沖突而失敗。

這些是我的啟動器和上游項目正在使用的 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

從您的日志中,我看到兩個可能的問題之一:

  1. 您將 spring-webmvc-5.3.2 覆蓋到更高或更低版本的某個地方
  2. 您的入門代碼中的問題(如果它配置了您的 WebMvc)

嘗試mvn dependency:treegradle dependencies來探索依賴項。 附上您的入門代碼。

我不得不使用 spring boot 2.4.1 來避免沖突。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM