首页 > 技术文章 > shop = mapper.readValue(shopStr, Shop.class); shop=null的问题

YoungSone 2020-03-03 01:42 原文

 

shop = mapper.readValue(shopStr, Shop.class); shop=null的问题

 

Unrecognized field "shopCategory" (class com.hbue.o2o.entity.Shop), not marked as ignorable (14 known properties: "shopName", "priority", "shopDesc", "createTime", "shopImg", "phone", "shopId", "owner", "enableStatus", "advice", "shopCategroy", "shopAddr", "lastEditTime", "area"])
at [Source: {"shopName":"测试","shopAddr":"爱爱","phone":"13366666777","shopDesc":"aaaaaaaaa","shopCategory":{"shopCategoryId":3},"area":{"areaId":3}}; line: 1, column: 95] (through reference chain: com.hbue.o2o.entity.Shop["shopCategory"])

 

 

 通过e.printStackTrace()打印异常信息发现Unrecognized field "shopCategory"错,然后进入shop实体类中发现shopCategory的set get方法出错 导致数据不匹配 无法进行json 数据转换

推荐阅读