我有一个 POJO 类扩展net.sf.gilead.pojo.gwt.LightEntity
. 我无法使用 .将 POJO 对象序列化为 JSON 字符串com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(obj)
。我收到此错误
com.fasterxml.jackson.databind.JsonMappingException:
Direct self-reference leading to cycle
(through reference chain: com.example.MyClass["underlyingValue"])
注意到 LightEntity 类有这个方法:
public Object getUnderlyingValue() {
return this;
}