我正在开发遗留系统。现在我需要将数据更改为Json,但卡在循环引用问题中。我搜索了答案,例如使用jackson reference
代码如下:
public abstract class OWLNode {
// parent-child links
@JsonBackReference protected List<OWLNode> superNodes;
@JsonBackReference protected List<OWLNode> children;
protected String label;
protected HierarchyElement element;
protected static OWLNode[] LEAF_NODE = new OWLNode[0];
}
错误是:
java.lang.IllegalStateException: circular reference error Offending field: children