spring data jpa 双向绑定关系的一个错误 Cannot call sendError() after the response has been committed

上图

spring data jpa 双向绑定关系的一个错误 Cannot call sendError() after the response has been committed

在团队列表中进行了关系绑定 团队用户

在查询时报错

spring data jpa 双向绑定关系的一个错误 Cannot call sendError() after the response has been committed

 

这是双向关系的一个问题,因为它们互相引用,在反序列化时,Jackson在无限循环中运行

建议是增加@JsonIgnore关系的一端。

spring data jpa 双向绑定关系的一个错误 Cannot call sendError() after the response has been committed

问题解决

如果这解决了问题,您可以查看@ JsonManagedReference / @ JsonBackReference和@JsonIdentityInfo。

https://www.toptal.com/javascript/bidirectional-relationship-in-json