title: Jaxb cycle (infinite loop) marshalling error - MOXy and Spring OXM
body: <p>I get a JAXB marshalling error (cycle infinite loop) - posted at end of this question.</p>
  
  <p>I know it's due to a 2 way object reference and I have used EclipseLink MOXy JAXB marshaller in a test case to resolve this specifying ID and IDREF and specified the JAXB provider using a jaxb.properties file containing</p>
  
  <pre><code>javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
  </code></pre>
  
  <p>However the production code uses Spring OXM and I cannot see how to achieve a similar result using this.</p>
  
  <p>I have added a jaxb.properties file but it isn't being used - I know this because I add an empty file as a test and it doesn't complain (like it did on the prototype test case).</p>
  
  <p>How do I specify the JAXB marshaller to use?
  It appears to be using: </p>
  
  <pre><code>org.eclipse.persistence.oxm.XMLMarshaller
  </code></pre>
  
  <p>whereas my working test case uses : </p>
  
  <pre><code>org.eclipse.persistence.jaxb.JAXBMarshaller
  </code></pre>
  
  <p>Exception:
      javax.xml.bind.MarshalException
       - with linked exception:
      [Exception [EclipseLink-25037] (Eclipse Persistence Services -<br>
      2.6.1.v20150916-55dc7c3):<br>
      <strong>org.eclipse.persistence.exceptions.XMLMarshalException
      Exception Description: A cycle is detected in the object graph.  This will 
      cause an infinite loop:</strong><br>
      at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal 
      (JAXBMarshaller.java:487)</p>