title: Infinite loop with spring-boot in a one to many relation
body: <p>In a rest application, I use spring boot with jpa.</p>
  
  <p>I have a class Lodger</p>
  
  <p>who have</p>
  
  <pre><code>@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "lodger")
  private List&lt;Reference&gt; referenceList;
  </code></pre>
  
  <p>In my class Reference, i have</p>
  
  <pre><code>@ManyToOne
  @JoinColumn(name = "lodgerId")
  private Lodger lodger;
  </code></pre>
  
  <p>when i call this method</p>
  
  <pre><code>@RequestMapping(value = "/lodgers/{lodgerId}", method = RequestMethod.GET)
  public Lodger getLogderById(@PathVariable("lodgerId") long lodgerId) {
      return lodgerService.getLodger(lodgerId);
  }
  </code></pre>
  
  <p>I get this error</p>
  
  <pre><code>org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: Infinite recursion (StackOverflowError) (through reference chain: server.bean.Lodger["referenceList"]-&gt;org.hibernate.collection.internal.PersistentBag[0]-&gt;server.bean.Reference["lodger"]-&gt;server.bean.Lodger["referenceList"]-&gt;org.hibernate.collection.internal.PersistentBag[0]-&gt;server.bean.Reference["lodger"]-&gt;server.bean.Lodger["referenceList"]...
  </code></pre>