How to map fields correctly using XmlElement for dozer

戏子无情 提交于 2019-12-11 15:03:24

问题


I have the following field

@Mapping("greatId")
@XmlElement(name = "great_key")
private String greatKey;

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 ?

I found exact same problem explained in : XmlElement ignored by Jackson during serialization


回答1:


Pretty sure that you are not using Jackson for serialization. ;) Get rid of the current serialization or make it respect the standard annotations.



来源:https://stackoverflow.com/questions/28878662/how-to-map-fields-correctly-using-xmlelement-for-dozer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!