When serializing from Java to JSON, Jackson generates an extra target
property for referenced entities when using the Spring Data MongoDB @DBRef
an
The Target field is added by Spring Data because it is a lazy collection. So it is like datahandler etc. in Hibernate for JPA.
Option1: To ignore them you just have to add @JsonIgnoreProperties(value = { "target" }) on class level
@Document(collection = "song")
@JsonIgnoreProperties(value = { "target" })
public class Song {
...
}
Option2: Make the Collection not lazy