'@OneToMany stackoverflow in Spring Data Rest

I have a Questions entity which has list of options as follows:

@OneToMany(mappedBy = "question")
List<Option> options;

And in Options entity I have specified the relation as :

@ManyToOne
@JoinColumn(name="question_id")
Question question;

When I hit /api/questions , it works fine but when I hit /api/questions/1 , it gives java.lang.StackOverflowError: null

What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source