I am trying to return a object from my controller which should be parsed to xml by spring. But I used the @XmlNamedObjectGraph (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.
How can I access the marshaller, which is used by spring to parse my object, in my controller?
ie:
@RequestMapping(value = "/xml/", method = RequestMethod.GET, produces = "application/xml")
@ResponseBody
public ResponseEntity<Customer> getXml() {
Customer customer = _customerService.getById(12);
...
marshaller.setProperty(MarshallerProperties.OBJECT_GRAPH, "default");
...
return new ResponseEntity<>(customer, HttpStatus.OK);
}
Thanks for your help in advance.