首页 新闻 会员 周边 捐助

springmvc 当用@ResponseBody注解返回json 但查询结果中有外键存在

0
悬赏园豆:5 [待解决问题]

@RequestMapping(value="/index",method=RequestMethod.POST)
@ResponseBody
public List<TArea> index() {
System.out.println("哈哈哈哈哈");
//ModelAndView model = new ModelAndView("forward:/index.jsp");
List<TArea> list = areaService.getAll(TArea.class);
//List<TPhoto> tPhotos = photoService.getAll(TPhoto.class);
//model.addObject("list", list);
//Map<String, Object> maps=new HashMap<>();
//maps.put("tPhotos", tPhotos);
//model.addObject("tPhotos", tPhotos);
//System.out.println(list.size());
//List<User> list = userService.getAll(User.class);
//System.out.println(list.get(0).getName());
return list;
}

 

 

 

 

 Caused by: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: cn.yznu.base.pojo.auth.TArea["views"]->org.hibernate.collection.internal.PersistentSet[0]->cn.yznu.base.pojo.auth.TView["area"]->cn.yznu.base.pojo.auth.TArea["views"]->org.hibernate.collection.internal.PersistentSet[0]->cn.yznu.base.pojo.auth.TView["area"]-> 
待-续的主页 待-续 | 初学一级 | 园豆:193
提问于:2018-04-23 22:10
< >
分享
所有回答(1)
0

ttttt

待-续 | 园豆:193 (初学一级) | 2020-12-10 16:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册