Приложение Spring загрузки не работает с Jackson2ObjectMapperBuilder. Видимости не существует - PullRequest
0 голосов
/ 28 мая 2020

В моем приложении Spring Boot у меня очень мало зависимостей:

implementation "org.springframework.boot:spring-boot-starter:$springBootVersion"
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

Приложение не запускается:

***************************
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:

    java.lang.invoke.MethodHandleNatives.resolve(Native Method)

The following method did not exist:

    org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.visibility(Lcom/fasterxml/jackson/annotation/PropertyAccessor;Lcom/fasterxml/jackson/annotation/JsonAutoDetect$Visibility;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;

The method's class, org.springframework.http.converter.json.Jackson2ObjectMapperBuilder, is available from the following locations:

    jar:file:/Users/me/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/4.3.25.RELEASE/76d29c076153e09961c8e6fd9b2d5c50bb80b902/spring-web-4.3.25.RELEASE.jar!/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.class

It was loaded from the following location:

    file:/Users/me/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/4.3.25.RELEASE/76d29c076153e09961c8e6fd9b2d5c50bb80b902/spring-web-4.3.25.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.http.converter.json.Jackson2ObjectMapperBuilder

Disconnected from the target VM, address: '127.0.0.1:57370', transport: 'socket'

Process finished with exit code 1

springBootVersion - 2.2.6.RELEASE

1 Ответ

0 голосов
/ 28 мая 2020

Зависимость spring-boot-starter, похоже, не включает spring-web, где находится необходимый класс. Добавьте implementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion" в свой файл Gradle и повторите попытку.

...