Spring boot Spring Boot 2.1.2和类com.fasterxml.jackson.annotation.JsonInclude

Spring boot Spring Boot 2.1.2和类com.fasterxml.jackson.annotation.JsonInclude,spring-boot,jackson,Spring Boot,Jackson,我的Sprint启动应用程序无法启动,因为它抱怨缺少com.fasterxml.jackson.annotation.JsonInclude$Value类,但我将jackson库作为依赖项,因此我认为可能存在一些冲突 弹簧日志: :: Spring Boot :: (v2.1.2.RELEASE) 00:22:54.084 [main ] ERROR ngframework.boot.web.embedded.tomcat.TomcatStarter - Error

我的Sprint启动应用程序无法启动,因为它抱怨缺少com.fasterxml.jackson.annotation.JsonInclude$Value类,但我将jackson库作为依赖项,因此我认为可能存在一些冲突

弹簧日志:

 :: Spring Boot ::        (v2.1.2.RELEASE)

00:22:54.084 [main      ] ERROR ngframework.boot.web.embedded.tomcat.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
00:22:55.063 [main      ] ERROR         org.springframework.boot.SpringApplication - Application run failed
pom.xml
(依赖项):


org.springframework.boot
SpringBootStarterWeb
2.1.2.1发布
org.springframework.boot
弹簧起动试验
2.1.2.1发布
测试
伊奥·斯普林福克斯
springfox-Swagger 2
2.9.2
com.fasterxml.jackson.core
杰克逊数据绑定
2.9.4
com.fasterxml.jackson.core
杰克逊核心
2.9.4
com.fasterxml.jackson.core
杰克逊注释
2.9.4
有没有人已经面临过类似的问题?
感谢您,spring boot会自动添加jackson core、jackson注释和jackson数据绑定罐。
因此,您不需要显式地添加它们,除非您希望覆盖SpringBoot提供的jar版本


对这两件文物使用以下版本:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.10.0.pr1</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.4</version>
</dependency>

com.fasterxml.jackson.core
杰克逊核心
2.10.0.pr1
com.fasterxml.jackson.core
杰克逊注释
2.9.4
此外,如果maven构建失败,请将maven编译器插件版本更新为最新版本。
Jackson在类ObjectMapper的方法签名中做了一些更改,如果实现了,请处理相同的问题。

“除非您希望覆盖spring boot提供的jar版本”-若要覆盖,您必须首先从spring boot依赖项中排除现有的依赖项。@Vusal或您可以设置jackson.version属性(如果使用父POM),或将jackson BOM放置在spring boots之前。您只需从spring工具套件依赖项管理选项卡添加或管理依赖项即可。如果您提到版本,那么它将自动覆盖spring管理的版本。请使用spring引导父POM或BOM。SpringBoot针对BOM或POM避免的依赖项的特定版本进行测试。
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.10.0.pr1</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.4</version>
</dependency>