In Spring, beans are configured using the <code>applicationContext.xml</code> file. The following XML file will be used to configure our beans:

<source lang="xml">

<source lang="xml">

<?xml version="1.0" encoding="UTF-8"?>

<?xml version="1.0" encoding="UTF-8"?>

Line 26:

Line 26:

** We use the "marshaller" property to indicate that we want Spring to inject an instance of <code>org.springframework.oxm.jaxb.Jaxb2Marshaller</code>

** We use the "marshaller" property to indicate that we want Spring to inject an instance of <code>org.springframework.oxm.jaxb.Jaxb2Marshaller</code>

* jaxbMarshaller

* jaxbMarshaller

−

** This is an instance of the <code>org.springframework.oxm.jaxb.Jaxb2Marshaller</code> class that will be injected into our xmlHelper

+

** This is an instance of the <code>org.springframework.oxm.jaxb.Jaxb2Marshaller</code> class that will be injected into our xmlHelper bean

** We use the "contextPath" property to indicate the location of the model classes, <code>jaxb.properties</code>, and an <code>ObjectFactory</code> class or <code>jaxb.index</code> file

** We use the "contextPath" property to indicate the location of the model classes, <code>jaxb.properties</code>, and an <code>ObjectFactory</code> class or <code>jaxb.index</code> file

Line 47:

Line 47:

=== Requirements ===

=== Requirements ===

−

The following are required to use EclipseLink JAXB with Spring.

+

* EclipseLink

−

+

** The latest version of EclipseLink can be found on the [http://www.eclipse.org/eclipselink/downloads EclipseLink download] page. <code>eclipselink.jar</code> must be on the classpath.

−

==== EclipseLink ====

+

* Spring Framework

−

The latest version of EclipseLink can be found on the [http://www.eclipse.org/eclipselink/downloads EclipseLink download] page. <code>eclipselink.jar</code> must be on the classpath.

+

** The latest version of the Spring Framework can be found on the [http://www.springsource.org/download Spring download] page.

−

+

** The JAR files in the <code>dist</code> folder of your Spring install as well as <code>commons-logging.jar</code> found in <code>/projects/spring-build/lib/ivy</code> must be on the classpath.

−

==== Spring Framework ====

+

* Model Classes

−

The latest version of the Spring Framework can be found on the [http://www.springsource.org/download Spring download] page. The JAR files in the <code>dist</code> folder of your Spring install as well as <code>commons-logging.jar</code> found in <code>/projects/spring-build/lib/ivy</code> must be on the classpath.

+

** The following model classes make use of standard JAXB annotations as well as MOXy extensions:

Latest revision as of 12:37, 26 November 2010

Contents

In order to use EclipseLink JAXB with the Spring Framework, you simply need a jaxb.properties file and an eclipselink.jar on the classpath. No other special configuration is required. This document will demonstrate how to configure Spring to use EclipseLink JAXB.

Configuration: applicationContext.xml

In Spring, beans are configured using the applicationContext.xml file. The following XML file will be used to configure our beans: