There is a cycle in the hierarchy!List res = resourceService.findAll();JSONArray datalist = JSONArray.fromObject(res);//这里报错there is a cycle in the hierarchy用网上提供的方法不好使下面是Resource属性private Integer id;\x05privat

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 20:59:45
There is a cycle in the hierarchy!List res = resourceService.findAll();JSONArray datalist = JSONArray.fromObject(res);//这里报错there is a cycle in the hierarchy用网上提供的方法不好使下面是Resource属性private Integer id;\x05privat

There is a cycle in the hierarchy!List res = resourceService.findAll();JSONArray datalist = JSONArray.fromObject(res);//这里报错there is a cycle in the hierarchy用网上提供的方法不好使下面是Resource属性private Integer id;\x05privat
There is a cycle in the hierarchy!
List res = resourceService.findAll();
JSONArray datalist = JSONArray.fromObject(res);//这里报错there is a cycle in the hierarchy
用网上提供的方法不好使
下面是Resource属性
private Integer id;
\x05private String title;
\x05private String description;
\x05private Set roles = new HashSet();
Resource和Role有多对多的关系
Role的属性
private Integer id;
\x05private String roleName;
\x05private Set res = new HashSet();

There is a cycle in the hierarchy!List res = resourceService.findAll();JSONArray datalist = JSONArray.fromObject(res);//这里报错there is a cycle in the hierarchy用网上提供的方法不好使下面是Resource属性private Integer id;\x05privat
有把有关联的属性放到json数组中就可以了.因为Resource的json数组中有roles数组,而且roles的数组元素中又有Resource数组,死循环了.用JSONConfig把roles去除就可以了.