Jaxb2XmlEncoder can not encode JAXBElement #32972
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: superseded
An issue that has been superseded by another
Affects: <Spring Framework version>
Spring boot: 3.3.0
I'm trying to use
WebClient
to send XML date using Jaxb.I have generate my classes using
jaxb2-maven-plugin
it seems that this plugin don't add@XmlRootElement
on classes.Without this annotation the Jaxb marshaler don't want to serialize my data with this error
impossible to serialize type “xxxxxx” as an element, as it has no @XmlRootElement annotation
.The other way to serialize data is to use
JAXBElement
, but theJAXBElement
is not supported byJaxb2XmlEncoder
, the can encode method say:to work properly, I have create a customer encoder with this code:
I don't know is there is a reason to not support
JAXBElement
while this issue #30552 provides support on serialization process.Thanks for your help
The text was updated successfully, but these errors were encountered: