如果我对您的理解正确,那么@JsonIgnoreProperties
注释应该可以帮助您:
@JsonIgnoreProperties("site")
@OneToMany(mappedBy="site")
private List<Building> buildings;
@JsonIgnoreProperties("buildings")
@ManyToOne
private Site site;
如何根据引用哪个实体来交换@JsonBackReference和@JsonManagedReference
如果我对您的理解正确,那么@JsonIgnoreProperties
注释应该可以帮助您:
@JsonIgnoreProperties("site")
@OneToMany(mappedBy="site")
private List<Building> buildings;
@JsonIgnoreProperties("buildings")
@ManyToOne
private Site site;