title: Spring MVC - set JAXB marshaller property when using @ResponseBody
body: <p>I am trying to return a object from my controller which should be parsed to xml by spring.
  But I used the <a href="http://blog.bdoughan.com/2013/03/moxys-object-graphs-inputoutput-partial.html" rel="nofollow">@XmlNamedObjectGraph</a> (from moxy eclipselink) annotation in my class to customize the returned object. So I have to set the property MarshallerProperties.OBJECT_GRAPH from the marshaller. </p>
  
  <p>How can I access the marshaller, which is used by spring to parse my object, in my controller?</p>
  
  <p>ie:</p>
  
  <pre><code>@RequestMapping(value = "/xml/", method = RequestMethod.GET, produces = "application/xml")
  @ResponseBody
  public ResponseEntity&lt;Customer&gt; getXml() {
      Customer customer = _customerService.getById(12);
      ...
      marshaller.setProperty(MarshallerProperties.OBJECT_GRAPH, "default");
      ...
      return new ResponseEntity&lt;&gt;(customer, HttpStatus.OK);
  }
  </code></pre>
  
  <p>Thanks for your help in advance.</p>