Direct self-reference leading to cycle exception

后端 未结 5 648
执笔经年
执笔经年 2021-01-04 00:18

I have a class; something like the following:

public abstract class ElasticSearchValue {

  private Long txId;
  private Long currentTxId;
  private         


        
5条回答
  •  离开以前
    2021-01-04 00:23

    Try @JsonIdentityInfo annotation as given in this example. More details here http://wiki.fasterxml.com/JacksonFeatureObjectIdentity

    @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
    public class Identifiable
    {
        public int value;
    
        public Identifiable next;
    }
    

提交回复
热议问题