How to map fields correctly using XmlElement for d

2019-09-01 08:25发布

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条回答
forever°为你锁心
2楼-- · 2019-09-01 08:36

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

查看更多
登录 后发表回答