如何使用XmlElement推土机正确映射字段 [英] How to map fields correctly using XmlElement for dozer
本文介绍了如何使用XmlElement推土机正确映射字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下字段
@Mapping("greatId")
@XmlElement(name = "great_key")
private String greatKey;
所以我的getter和setter是getGreatKey()
和setGreatKey(..)
.然后,我的JSON不包含带有字段"great_key"的响应.但是,如果我添加吸气剂getGreat_key()
,则它将返回字段.我不想添加那些吸气剂.我在做什么错了?
So my getters and setters are getGreatKey()
, and setGreatKey(..)
. Then my JSON do not contain the response with field "great_key". But if i add a getter getGreat_key()
, then it returns the fields. I dont want to add those getters. What am i doing wrong ?
我发现在 XmlElement在序列化期间被Jackson忽略的问题完全相同
推荐答案
请确保您没有使用Jackson进行序列化. ;)摆脱当前的序列化或使其遵循标准注释.
Pretty sure that you are not using Jackson for serialization. ;) Get rid of the current serialization or make it respect the standard annotations.
这篇关于如何使用XmlElement推土机正确映射字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文