jackson介绍

  java代码中实现序列化和反序列化的工具类

jackson使用Demo

  https://github.com/Naylor55/JavaDebrisCode/tree/branch_Java-Serializable/javaserializable

Ideal控制台报错信息

2019-05-22 15:43:20.333 [main] ERROR org.springframework.boot.SpringApplication.reportFailure:837 - Application run failed
java.lang.AbstractMethodError: com.fasterxml.jackson.core.type.ResolvedType.getReferencedType()Lcom/fasterxml/jackson/core/type/ResolvedType;
at com.fasterxml.jackson.core.type.ResolvedType.isReferenceType(ResolvedType.java:59)
at com.fasterxml.jackson.datatype.jdk8.Jdk8TypeModifier.modifyType(Jdk8TypeModifier.java:20)
at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:413)
at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:354)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.getJavaType(AbstractJackson2HttpMessageConverter.java:323)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:158)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:150)
at org.springframework.web.client.RestTemplate$AcceptHeaderRequestCallback.doWithRequest(RestTemplate.java:805)
Disconnected from the target VM, address: '127.0.0.1:57769', transport: 'socket'
at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:868)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:685)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:644)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:564)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:218)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:96)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:628)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:364)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
at com.leading.WarehouseserviceApplication.main(WarehouseserviceApplication.java:50)

  

报错原因

  Spring-Boot框架自身默认就引用了jackson,如果你在自己的开发项目中再次引用,就会有冲突。然而,JVM 不会告诉你是引用有冲突,而是直接给你一个类型有问题的提示。意思就是我只能告诉你类型有问题,具体的你自己查吧。IDEAL 作为一个开发工具,在这点上面也没有做出点贡献。Java这个生态缺陷还是很大的!!!

  spriing-boot 默认引用

  自己项目的pom中找到:org.springframework.boot , 并点击进去。

     <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath />
</parent>

  然后再找:spriing-boot-dependencies ,并点击进去

 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>

  然后就可以看到spring-boot 对jackson 的引用,如下图

  

解决办法

  在当前开发项目的pom文件中删除对jackson的依赖,即删除如下图所示

  

Spring-boot 项目中使用 jackson 遇到的一个问题的更多相关文章

  1. 在Spring Boot项目中使用Spock框架

    转载:https://www.jianshu.com/p/f1e354d382cd Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring B ...

  2. 在Spring Boot项目中使用Spock测试框架

    本文首发于个人网站:在Spring Boot项目中使用Spock测试框架 Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目 ...

  3. 你真的理解 Spring Boot 项目中的 parent 吗?

    前面和大伙聊了 Spring Boot 项目的三种创建方式,这三种创建方式,无论是哪一种,创建成功后,pom.xml 坐标文件中都有如下一段引用: <parent> <groupId ...

  4. Spring Boot项目中使用Swagger2

    Swagger2是一款restful接口文档在线生成和在线接口调试工具,Swagger2在Swagger1.x版本的基础上做了些改进,下面是在一个Spring Boot项目中引入Swagger2的简要 ...

  5. Spring Boot2 系列教程(三)理解 Spring Boot 项目中的 parent

    前面和大伙聊了 Spring Boot 项目的三种创建方式,这三种创建方式,无论是哪一种,创建成功后,pom.xml 坐标文件中都有如下一段引用: <parent> <groupId ...

  6. Spring Boot项目中使用Mockito

    本文首发于个人网站:Spring Boot项目中使用Mockito Spring Boot可以和大部分流行的测试框架协同工作:通过Spring JUnit创建单元测试:生成测试数据初始化数据库用于测试 ...

  7. Spring Boot项目中如何定制拦截器

    本文首发于个人网站:Spring Boot项目中如何定制拦截器 Servlet 过滤器属于Servlet API,和Spring关系不大.除了使用过滤器包装web请求,Spring MVC还提供Han ...

  8. Spring Boot项目中如何定制PropertyEditors

    本文首发于个人网站:Spring Boot项目中如何定制PropertyEditors 在Spring Boot: 定制HTTP消息转换器一文中我们学习了如何配置消息转换器用于HTTP请求和响应数据, ...

  9. Spring Boot项目中如何定制servlet-filters

    本文首发于个人网站:Spring Boot项目中如何定制servlet-filters 在实际的web应用程序中,经常需要在请求(request)外面增加包装用于:记录调用日志.排除有XSS威胁的字符 ...

  10. Spring Boot 项目中的 parent

    前言 我们成功创建Spring Boot之后,pom.xml坐标文件中都会有如下一段引用: <parent> <groupId>org.springframework.boot ...

随机推荐

  1. adobe flash player 下载地址

    1. https://www.adobe.com/cn/products/flashplayer/distribution3.html

  2. IntelliJ IDEA Sringboot 项目部署到外部Tomcat服务器

    <packaging>war</packaging> 添加依赖 <dependency> <groupId>org.springframework.bo ...

  3. linux命令学习笔记(21):find命令之xargs

    xargs是一条Unix和类Unix操作系统的常用命令.它的作用是将参数列表转换成小块分段传递给其他命令,以避免参数列表过长的问题 xargs的作用一般等同于大多数Unix shell中的反引号,但更 ...

  4. python实现列队

    1 列队定义 队列是项的有序结合,其中添加新项的一端称为队尾,移除项的一端称为队首.当一个元素从队尾进入队列时,一直向队首移动,直到它成为下一个需要移除的元素为止. 最近添加的元素必须在队尾等待.集合 ...

  5. FFmpeg 'scale' filter not present, cannot convert pixel formats.

    /*************************************************************************** * FFmpeg 'scale' filter ...

  6. CH#24C 逃不掉的路 和 HDU3686 Traffic Real Time Query System

    逃不掉的路 CH Round #24 - 三体杯 Round #1 题目描述 现代社会,路是必不可少的.任意两个城镇都有路相连,而且往往不止一条.但有些路连年被各种XXOO,走着很不爽.按理说条条大路 ...

  7. http头部解释

    If-Modified-Since,If-Node-Match,ETag,Last-Modified 1 属于 Request Headers的是:If-Modified-Since,If-Node- ...

  8. 使用Visual Studio进行单元测试-Part5

    本文主要介绍Visual Studio(2012+)单元测试框架的一些技巧: 如何模拟类的静态构造函数 如何测试某方法被调用过 如何测试某方法执行的次数 并行编程测试注意事项 一.如何模拟类的静态构造 ...

  9. 数据库JSON字段设计思路

    任务的阶段信息直接存储为JSON格式,这种格式避免了表关联,避免建表,应用层处理也简单的多了. 1. JSON内容为信息性质,而不具备非统计功能:简单讲就是展示,不能用于深度处理: 2. JSON内容 ...

  10. cocos2d-x 屏幕分辨率适配方法

    转自:http://blog.csdn.net/somestill/article/details/9950403 bool AppDelegate::applicationDidFinishLaun ...