【发布时间】:2018-11-27 02:10:00
【问题描述】:
我有一个扩展 net.sf.gilead.pojo.gwt.LightEntity 的 POJO 类。我无法使用com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(obj) 将 POJO 对象序列化为 JSON 字符串。我收到此错误
com.fasterxml.jackson.databind.JsonMappingException:
Direct self-reference leading to cycle
(through reference chain: com.example.MyClass["underlyingValue"])
注意到 LightEntity 类有这个方法:
public Object getUnderlyingValue() {
return this;
}
【问题讨论】:
标签: java gwt objectmapper json-serialization