Question: https://stackoverflow.com/questions/64095580/spring-boot-with-an-jaxbelement-result

Bug? In a fairly old release note of Spring-OMX I notice that non-root elements should be supported. Then again they are not;

2020-09-30 11:21:01.200  WARN 67871 --- [0.0-8083-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not marshal [[bestaetigung=[ergebnis=NOTOK,fehlernummer=1,fehlertext=I'm sorry, your senderId 'test' is not configured.,zst=2020-09-30T11:21:00.476367]]]: JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "de.vdv453.AboAntwortType" as an element because it is missing an @XmlRootElement annotation]; nested exception is org.springframework.oxm.MarshallingFailureException: JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "de.vdv453.AboAntwortType" as an element because it is missing an @XmlRootElement annotation]]
        Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
        jaxb2Marshaller.setContextPath(ObjectFactory.class.getPackage().getName());
        Map<String, Object> prop = new HashMap<>();
        prop.put(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        jaxb2Marshaller.setMarshallerProperties(prop);
        jaxb2Marshaller.setCheckForXmlRootElement(false);
        return new MarshallingHttpMessageConverter(jaxb2Marshaller);

Comment From: skinkie

Ok, I am able to make this to work at least by returning a wrapped JAXBElement<> and setting jaxb2Marshaller.setSupportJaxbElementClass(true);