19.13 XML Mapping View
TheMappingJackson2XmlView
uses theJackson XML extension'sXmlMapper
to render the response content as XML. If the model contains multiples entries, the object to be serialized should be set explicitly using themodelKey
bean property. If the model contains a single entry, it will be serialized automatically.
XML mapping can be customized as needed through the use of JAXB or Jackson’s provided annotations. When further control is needed, a customXmlMapper
can be injected through theObjectMapper
property for cases where custom XML serializers/deserializers need to be provided for specific types.