cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maarten Winkels <>
Subject Configuring Xml Adapters for CXF
Date Wed, 29 Oct 2014 14:32:15 GMT

I would like to use a (spring) configured XmlAdapter for marshalling and unmarshalling by
JAXB exposes a setAdapter() method for this on the Marshaller(
) and Unmarshaller (

Unfortunately I cannot find a way to inject a configured XmlAdapter in the JAXBDataBinding.
What am I missing?

I have resolved the issue for now by patching the DataWriterImpl:

public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
      private final XmlAdapter[] adapters;
    public DataWriterImpl(JAXBDataBinding binding, @SuppressWarnings("rawtypes") XmlAdapter[]
adapters) {
            this.adapters = adapters;
    public Marshaller createMarshaller(Object elValue, MessagePartInfo part) {
            for (@SuppressWarnings("rawtypes") XmlAdapter adapter : adapters)
        return marshaller;

And the DataReader<Impl> and JAXBDataBinding in a similar manner.

Is there a better way to do this? Should this be a new feature request?

Regards, -Maarten Winkels

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message