org.springframework.http.converter.HttpMessageConversionException

一 问题描述:
org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
二 分析问题的原因
1.感觉是jar这块引入有点问题
2 不能序列化
三 解决措施
引入jar包依赖

解决1 :
com.alibaba
fastjson
1.2.62

解决 2: 不要对序列化的内容添加ID
四知识拓展
JSON官网
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
JSON is built on two structures:
A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages also be based on these structures.

In JSON, they take on these forms:

An object is an unordered set of name/value pairs. An object begins with {left brace and ends with }right brace. Each name is followed by :colon and the name/value pairs are separated by ,comma.

在这里插入图片描述
An array is an ordered collection of values. An array begins with [left bracket and ends with ]right bracket. Values are separated by ,comma.

在这里插入图片描述
A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.
A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.
A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used.
Whitespace can be inserted between any pair of tokens. Excepting a few encoding details, that completely describes the language.
JSON(JavaScript对象表示法)是一种轻量级的数据交换格式。人类易于阅读和书写。机器很容易解析和生成。它基于JavaScript编程语言标准ECMA-262第三版(1999年12月)的子集 。JSON是一种完全独立于语言的文本格式,但是使用C语言家族的程序员所熟悉的约定,包括C,C ++,C#,Java,JavaScript,Perl,Python等。这些属性使JSON成为理想的数据交换语言。

JSON建立在两种结构上:
名称/值对的集合。在各种语言中,这是作为对象,记录,结构,字典,哈希表,键列表或关联数组实现的。
值的有序列表。在大多数语言中,这是通过数组,向量,列表或序列实现的。
这些是通用数据结构。几乎所有现代编程语言都以一种或另一种形式支持它们。可以与编程语言互换的数据格式也应基于这些结构,这是有道理的。

在JSON中,它们采用以下形式:

的对象是一组无序名称/值对。一个对象以{ 左括号开始,以} 右括号结束。每个名称后面跟着:结肠和名称/值对被分开,逗号。
在这里插入图片描述

一个数组是值的有序集合。数组以[ 左括号开头,以] 右括号结尾。值由分开,逗号。

在这里插入图片描述
甲值可以是一个字符串,在双引号,或一个数字,或真或假的或零,或一个对象或一个阵列。这些结构可以嵌套。
甲串是零个或多个Unicode字符序列,包在双引号,使用反斜杠逃逸。字符表示为单个字符串。字符串非常类似于C或Java字符串。
一个数是非常像C或Java数,除了八进制和十六进制格式不被使用。
可以在任何一对标记之间插入空格。除了一些编码细节之外,它完全描述了该语言。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值