Spring REST, JSON "Can not handle managed/back reference 'defaultReference'" 415 Unsupported Media Type
As @Sharppoint said in comments, I solved the mine by removing @JsonManagedReference
BUT keep @JsonBackReference
.
For those asking, an alternative approach would be to use fasterxml's JsonIdentityInfo and to annotate your class with:
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
public class Account implements java.io.Serializable {
....
private Long id;
}
*Didnt have enough rep to comment.
I got it solved by getting rid of JsonManagedReference and JsonBackReference and replacing it with JsonIdentityInfo