Jackson: Multiple back-reference properties with name 'defaultReference'

后端 未结 4 1324
慢半拍i
慢半拍i 2021-02-11 18:25

I\'m trying to map a json (string format) to an object and I get the following error

com.fasterxml.jackson.databind.JsonMappingException: Multiple back-

4条回答
  •  别那么骄傲
    2021-02-11 19:28

    If you use @JsonBackReference on more than one getter/setter method in your project, you should distinguish them with a specific reference name.

    Maybe only one 'defaultReference' is allowed in the latest version?

    e.g

    In MovementView.java

    @JsonBackReference(value="user-movement")
    public User getUser() {
        return user;
    }
    

    In User.java

    @JsonManagedReference(value="user-movement")
    public MovementView getMovementView() {
        return movementView;
    }
    

提交回复
热议问题