Cannot construct instance of `com.**` (although at least one Creator exists)

 

JSON parse error: Cannot construct instance of `com.**` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.**` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (PushbackInputStream); line: 2, column: 2]]
 

spring boot 的post传递实体类的过程中出现了反向序列化的异常

解决方案
在实体类中添加无参构造函数。

 

原因
jackson的反序列化需要无参构造函数,而我在实体类中添加了有参数的构造函数。

在实体类中添加无参构造函数即可。

posted @ 2021-05-06 17:41  残星  阅读(10753)  评论(0编辑  收藏  举报