当前位置: 代码迷 >> J2EE >> There is a cycle in the hierarchy!该如何处理
  详细解决方案

There is a cycle in the hierarchy!该如何处理

热度:133   发布时间:2016-04-22 01:21:29.0
There is a cycle in the hierarchy!
用json-lib将list对象转成json串时提示"There is a cycle in the hierarchy!"
按照网上的解决方法加JsonConfg配置

JsonConfig config = new JsonConfig();
config.setJavaPropertyFilter(new PropertyFilter(){
public boolean apply(Object arg0, String arg1, Object arg2) {
if(arg1.equals("children")||arg1.equals("parent")){
return true;
}else{
return false;
}
}

--但结果还是一样的
实体类Module中有:
private Module parent;
private Set<Module> children = new HashSet<Module>(0);


------解决方案--------------------
json-lib不能解决这种有嵌套关系的对象吧。
  相关解决方案