What this thread does
Do first: place @JsonBackReference on the child's parent link when the JSON should serialize the forward tree without serializing the reverse edge.
Short answer
As of November 2026, Jackson 3.3.0 uses jackson-annotations 2.23; the annotations retain their com.fasterxml.jackson.annotation package. Infinite recursion (StackOverflowError) : inspect the exception's property chain rather than increasing stack size (serializer source).
Choose / don't choose
- Managed/back pair: choose parent-to-children JSON with a reverse parent link restored during reading; the reverse edge is omitted during serialization (managed, back).
@JsonIdentityInfo: choose when the client understands graph IDs and repeated references; don't promise that every occurrence will be a complete object (identity source).- Existing property ID: choose
ObjectIdGenerators.PropertyGeneratoronly when the named external property is available and unique in its scope; otherwise consider a generated ID (identity contract).
Not for: migrating Spring Boot and all its starters; see spring-boot-4-upgrade-from-3-5-jackson-3-starters-openrewrite.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
@JsonManagedReference | Forward parent-to-child property; serialize normally and pair with the child's compatible back property | Current shared annotation API | annotation |
@JsonBackReference | Reverse child-to-parent bean property; omitted during serialization and restored on deserialization; cannot be a collection, map or array | Current shared annotation API | annotation |
Reference value | Both sides default to "defaultReference"; give each distinct pair a matching, distinct logical name | Current shared annotation API | managed, back |
@JsonIdentityInfo.generator, property | Example choice: ObjectIdGenerators.IntSequenceGenerator.class with default property = "@id"; or PropertyGenerator with the actual external ID property name | Current shared annotation API | identity, generators |
@JsonIdentityInfo.scope | Default Object.class; IDs must be unique within the combination of generator and scope | Current shared annotation API | identity |
Order of operations
1. Decide the wire contract before annotating entities: omit reverse edges for a tree, or expose IDs for a graph. Avoid annotating both competing strategies onto the same relationship by accident. 2. For a tree, annotate the forward edge as managed and the reverse bean edge as back; match the logical names. Multiple pairs must not share one name (back-reference constraints). 3. For identity, annotate the graph node type. By default the first occurrence contains the full object plus ID; later occurrences contain just that ID. The consumer must resolve references within the document, not assume each value is a full nested object (identity lifecycle). 4. Serialize and deserialize representative cycles in the reader's application; inspect both edge shape and object identity. Collection elements can be identified objects, but the annotation does not give identity to a Java collection/map container itself (identity limitations).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
Infinite recursion (StackOverflowError) | A reported stack overflow | In Jackson 3, inspect DatabindException's repeated property path: for example an illustrative Parent children / Child parent alternation; annotate or remove the unbounded edge | serializer catches and prepends property paths |
NoSuchFieldError | Incompatible shared annotations can fail before relationship handling; stevenschlansker reported an older annotations jar with newer databind | Align the annotations dependency with the selected databind release; 3.3 notes specify annotations 2.23 | dependency report, current release |
ecavinat's December 21, 2013 report asks for IDs always wrapped as objects. That is a different wire format from the annotation's normal first-object/subsequent-ID behavior.
Missing
- The linked source does not confirm: A remaining forward/reverse cycle keeps expanding
- The linked source does not confirm: Managed/back references produce a directed tree, whereas identity annotations allow cycles to become ID references.
- The actual repeating property names depend on the application's model. The Parent/Child path above is an illustration, not a universal exception literal.
- Annotation choices do not define lazy-loading policy or a public DTO contract for every Hibernate association.
Checked
2026-11-12; Jackson 3.3.0 release, shared annotation/generator sources, current serializer source and dated ecavinat/stevenschlansker reports read. No graph serialization executed.
Started from a post by @FasterXML, packaged by the editor. Original post