In my project, I have a few classes that together make a dependency cycle. This cycle does not cause any trouble during serialization because I marked some fields as transient to break the cycle.
JsonDoc, however, ignores the transient modifier when creating object templates in JSONDocTemplateBuilder, and goes into infinite recursion up to the traditional StackOverflowError.
I could fix the issue by adding the following code in getDeclaredAllFields():
Similarly, in AbstractSpringJSONDocScanner.appendSubCandidates(), all fields are recursively explored and added to the candidates even if they are marked transient and thus will not be output by the API. It can easily be fixed by a similar check in the loop on the fields.
In my project, I have a few classes that together make a dependency cycle. This cycle does not cause any trouble during serialization because I marked some fields as
transient
to break the cycle.JsonDoc, however, ignores the
transient
modifier when creating object templates inJSONDocTemplateBuilder
, and goes into infinite recursion up to the traditionalStackOverflowError
.I could fix the issue by adding the following code in
getDeclaredAllFields()
:Similarly, in
AbstractSpringJSONDocScanner.appendSubCandidates()
, all fields are recursively explored and added to the candidates even if they are markedtransient
and thus will not be output by the API. It can easily be fixed by a similar check in the loop on the fields.I can make a PR if you want to save time.