Could not write JSON: Infinite recursion (StackOverflowError); nested exception spring boot

前端 未结 7 1292
时光说笑
时光说笑 2020-12-08 23:18

This is my District Controller, when I try to fetch data after saving I get the error, even when I try get object form getDistrict(Long id) the same strikes ple

相关标签:
7条回答
  • 2020-12-08 23:51

    This issue occurs when dealing with bi-directional mapping. Use @JsonManagedReferenc and @JsonBackReference in DAO/Entity class

    @JsonManagedReference is the forward part of reference – the one that gets serialized normally. @JsonBackReference is the back part of reference – it will be omitted from serialization.

    (Read More)

    0 讨论(0)
提交回复
热议问题