Access Keys:
Skip to content (Access Key - 0)

JAXB Transformers

Jul 26, 2010 12:00

Robin Pille

Jan 31, 2014 11:39

Mulesoft Current Mule Documentation

JAXB Transformers

Mulesoft Documentation Page


JAXB Transformers

The JAXB transformers allow objects to be serialized to XML and back again using the JAXB binding framework. To configure a transformer that will convert XML to a Person object use 

You can then reference this transformer from an endpoint:

The returnClass is a common transformer attribute and defines that this transformer will create a Person object.

Note that we have a reference to a JAXBContext via the jaxbContext-ref attribute, you can create this context object in your configuration file.

You can always use Spring to create objects as well. To create the JAXBContext using spring you could add the following to your Mule XML configuration too.

The opposite transformer would allow you to convert from a Person object to XML -


JAXB Bindings

Mule offers automatic JAXB Bindings so you don't even need use these transformers for most scenarios.