PruthviRaj Reddy
PruthviRaj Reddy

Reputation: 104

Spring boot autoconfigure application start fails

I've built my own starter and the autoconfigure step fails with dependency conflict.

These are the spring boot versions both my starter and upstream project are using

'spring-boot-gradle-plugin', version2.1.8.RELEASE

'spring-boot-autoconfigure', version: '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

Upvotes: 1

Views: 1360

Answers (2)

PruthviRaj Reddy
PruthviRaj Reddy

Reputation: 104

I had to use spring boot 2.4.1 to avoid the conflict.

Upvotes: 0

Grigorii Riabov
Grigorii Riabov

Reputation: 215

From your log I see one of two possible problems:

  1. Somewhere you override spring-webmvc-5.3.2 to a higher or lower version
  2. Problem in your starter code (if it configure your WebMvc)

Try mvn dependency:tree or gradle dependencies to explore dependencies. Attached your starter code.

Upvotes: 2

Related Questions