MismatchedInputException Cannot construct instance of `xxx` cannot deserialize from Object value
·
调试的时候发现有类似如下报错:
JSON parse error: Cannot construct instance of `xxx` (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 `xxx` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: (PushbackInputStream); line: 1, column: 2]
controller参数传了一个实体类:CategoryEntity
@RequestMapping("/save")
public R save(@RequestBody CategoryEntity category){
categoryService.save(category);
return R.ok();
}
原本该实体是:
@Data
@TableName("pms_category")
public class CategoryEntity implements Serializable {
...
}
在该实体类上加上@NoArgsConstructor(无参构造),就可以了:
@Data
@NoArgsConstructor
@TableName("pms_category")
public class CategoryEntity implements Serializable {
...
}
更多推荐
所有评论(0)