Spring boot应用失败,Jackson2ObjectMapperBuilder。可见性不存在

【Spring boot应用失败,Jackson2ObjectMapperBuilder。可见性不存在】世事洞明皆学问,人情练达即文章。这篇文章主要讲述Spring boot应用失败,Jackson2ObjectMapperBuilder。可见性不存在相关的知识,希望能为你提供帮助。
在我的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.classIt 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.jarAction:Correct the classpath of your application so that it contains a single, compatible version of org.springframework.http.converter.json.Jackson2ObjectMapperBuilderDisconnected from the target VM, address: '127.0.0.1:57370', transport: 'socket'Process finished with exit code 1

springBootVersion为2.2.6.RELEASE
答案spring-boot-starter依赖项似乎不包括所需类所在的spring-web。将implementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"添加到您的Gradle文件中,然后重试。

    推荐阅读