Jackson ignores unnecessary fields when deserializing

Sometimes, if a field is added to the database table, but the returned JSON string contains a field we do not need, an exception will be thrown when the corresponding entity class does not contain the field, telling you that some fields are not found in the entity class. The solution is simple. After declaring objectmapper, add the above code:

objectMapper. configure(DeserializationFeature.FAIL_ON_UNKNowN_PROPERTIES,

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>