Spring MVC
@Bean("xmlView") public View marshallingView() { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setClassesToBeBound(User.class); MarshallingView view = new MarshallingView(); view.setMarshaller(marshaller); return view; }