Spring Boot多个jackson递归

Spring Boot多个jackson递归,spring,recursion,spring-boot,jackson,Spring,Recursion,Spring Boot,Jackson,人: @实体 @表(name=“person”) 公共阶层人士{ @身份证 @GeneratedValue(策略=GenerationType.AUTO) 私有int-id; @列(name=“name”,null=false,长度=30) 私有字符串名称; @列(name=“age”,nullable=false,length=2) 私人互联网; @许多 私人名单朋友; } 人事控制员: @Entity @Table(name = "person") public class Person{

人:

@实体
@表(name=“person”)
公共阶层人士{
@身份证
@GeneratedValue(策略=GenerationType.AUTO)
私有int-id;
@列(name=“name”,null=false,长度=30)
私有字符串名称;
@列(name=“age”,nullable=false,length=2)
私人互联网;
@许多
私人名单朋友;
}
人事控制员:

@Entity
@Table(name = "person")
public class Person{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    @Column(name = "name", nullable = false, length = 30)
    private String name;

    @Column(name = "age", nullable = false, length = 2)
    private int age;

    @ManyToMany
    private List<Person> friends;
}
@RestController
@请求映射(“/人”)
公共类个人控制器{
@自动连线
人情服务人情服务;
@RequestMapping(值={“/findAll”},方法=RequestMethod.GET)
公共对象findAll(){
List people=personService.findAll();
Map response=newhashmap();
响应。放置(“msg”王安生王人!);
回答。把(“人”,人);
返回响应;
}
}
数据库: 餐桌上的人

餐桌上的朋友


为什么“/findAll”isinfinite循环的结果是?

此链接将帮助您解决问题。

对不起,我犯了一个错误。数据库不合适,业务逻辑不正确。

首先最好只将代码作为片段与问题一起提供,而不是照片。这里的问题很容易理解。其次,您缺少2张图像。请编辑并更新您的问题。
@RestController
@RequestMapping("/person")
public class PersonController{
    @Autowired
    PersonService personService;

    @RequestMapping(value = {"/findAll"}, method = RequestMethod.GET)
    public Object findAll(){
        List<Person> people = personService.findAll();
        Map<String, Object> response = new HashMap<String, Object>();
        response.put("msg", "王安生王person!");
        response.put("people", people);
        return response;
    }
}