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

2021/5/6 18:28:58

本文主要是介绍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的反序列化需要无参构造函数,而我在实体类中添加了有参数的构造函数。

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



这篇关于Cannot construct instance of `com.**` (although at least one Creator exists)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程