Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/MOXy/Runtime/Specifying the EclipseLink Runtime"

(Specifying the EclipseLink Runtime)
m (Specifying the EclipseLink Runtime)
Line 6: Line 6:
 
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
 
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
 
</source>
 
</source>
 +
 +
Then when you create a JAXBContext using the standard APIs it will be the MOXy implementation:
 +
 +
<source lang="java">
 +
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
 +
</source>
 +
 +
Since none of your application code needs to change, you can seamlessly switch between JAXB implementations.

Revision as of 10:41, 8 July 2010

Specifying the EclipseLink Runtime

Specifying the EclipseLink MOXy JAXB runtime is easy. Simply add a text file named jaxb.properties in the same directory as your model classes with the following entry:

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

Then when you create a JAXBContext using the standard APIs it will be the MOXy implementation:

JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);

Since none of your application code needs to change, you can seamlessly switch between JAXB implementations.