学无先后,达者为师

网站首页 编程语言 正文

数据接受异常:org.springframework.http.converter. HttpMessageNotReadableException: Could not read document

作者:砥砺前行冲冲冲 更新时间: 2022-08-13 编程语言

异常描述

org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unrecognized field “inputType”

原因

后端用@RequestBody注解接收Json实体类,但前端传来的Json中有实体类没有的字段“inputType”

解决

后端在实体类上添加注解@JsonIgnoreProperties(ignoreUnknown = true)忽略前端所传来的无效字段

原文链接:https://blog.csdn.net/manonggeerdan/article/details/125222315

栏目分类
最近更新