So I\'m struggling to get my beans encoded in json... First I tried with codehaus\' jackson 1.9.13 and Spring MVC 3.1.1. I had some issues until I managed to get to \"Direct
Alright, I figured this out.
First, as suspected, Spring MVC wasn't calling Jackson to serialize the entities. As I found here, I needed to modify mvc:annotation-driven
to
After that was done, I was back to Direct self-reference exception
... So after I looked that up for a good hour, I finally found I 'simply' needed to add
an annotation to some classes.
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
This annotation means that if some object is repeated while in the serializer it will be serialized once then after that will only be referenced by an @id
created by the serializer.