反序列化问题

问题:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of

`com.yiyezhiqiu.comconnectionsend.model.RequestEntity` (no Creators, like default construct, exist):

cannot deserialize from Object value (no delegate- or property-based Creator)

读一下问题,大概是说某个实体类数据绑定异常,如没有默认构造器存在。

jackson在反序列化的时候必须要提供默认构造,而自己实体类中写了带参构造,导致无法生成无参构造,故手动添加无参构造即可。

在RequestBody和ResponseBody来接收和返回数据时多注意这点。

猜你喜欢

转载自www.cnblogs.com/yiyezhiqiuwuchen/p/12596559.html