Skip to main content
Jump to: navigation, search


In order to use EclipseLink JAXB with Spring, all that is required is a file and eclipselink.jar. No other special configuration is required. This example will demonstrate how to configure Spring to use EclipseLink JAXB.


The latest version of EclipseLink can be found on the EclipseLink download page. eclipselink.jar needs to be on the classpath.

Following is the file that tells Spring to use EclipseLink JAXB - this file needs to be on the classpath:

javax.xml.bind.context.factory = org.eclipse.persistence.jaxb.JAXBContextFactory


Spring supports both the JAXB 1.0 and the JAXB 2.0 API as XML marshalling strategies. EclipseLink JAXB implements JAXB 2, so for this example we will make use of the org.springframework.oxm.jaxb.Jaxb2Marshaller class.

Configuration: applicationContext.xml

This configuration file will be used to configure the beans used in this example.

<?xml version="1.0" encoding="UTF-8"?>
    <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="contextPath" value="example.gettingstarted"/>
    <bean id="xmlHelper" class="example.gettingstarted.XMLHelper">
        <property name="marshaller" ref="jaxbMarshaller"/>

Back to the top