问题
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