Deserializing cyclic JSON with only one class involved with Jackson
<p>Is it possible to deserialize the following class with Jackson?</p>

<p>So the original version of the question wasn't entirely accurate. Here's a minimal example to reproduce the problem.</p>

<pre><code>import java.io.IOException;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.databind.ObjectMapper;

@JsonIdentityInfo(
  generator = ObjectIdGenerators.IntSequenceGenerator.class,
  property = "id")
public class Thing {

  public Thing thing;

  @JsonCreator
  public Thing(@JsonProperty("thing") Thing thing) {
    this.thing = thing;
  }

  public static void main(String[] args) throws IOException {
    ObjectMapper mapper = new ObjectMapper();

    Thing cyclic = new Thing(null);
    cyclic.thing = cyclic;

    String serialised = mapper.writeValueAsString(cyclic);
    System.out.println(serialised);

    Thing deserialised = mapper.readerFor(Thing.class).readValue(serialised);
    System.out.println(deserialised.thing == deserialised);
  }
}
</code></pre>

<p>This causes the unresolved forward reference exception. The issue seems to be that Jackson is told to use the annotated constructor, but it can't due to the cyclic dependency.</p>