给定以下两个实体:@Entitypublic class Goal {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String description;private BigDecimal amount;@Emailprivate String email;@Emailprivate String supervisorEmail;private LocalDateTime deadline;@Enumerated(EnumType.STRING)@Column(nullable = false)private PaymentPurpose purpose;@Enumerated(EnumType.STRING)private GoalStatus status;@ManyToOne(cascade = CascadeType.ALL)private Person person;//getters and setters}和@Entitypublic class Person { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String firstName; private String lastName; @Email private String email; @OneToMany(mappedBy = "person") private List<Goal> goals; //getters and setters}当我goalRepository.findAll()在插入带有DummyGoal的Dummy后打电话时Person,我得到了永无止境的递归循环。添加@JsonIgnore到goal列表中Person并没有帮助。我也试过了@JsonIgnoreProperties。我想念什么?
添加回答
举报
0/150
提交
取消