Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Moxy as default JAXB Implementation

Tags:

json

xml

jaxb

moxy

In order to use Moxy as JAXB Implementation, one has to add a file called jaxb.properties in the folder with the domain classes of the application and include the following line

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

Is it possible to make moxy the default for the project ? In case I have many different folders with annotated domain classes in which folder should I put this file?

like image 505
Edmondo1984 Avatar asked Nov 06 '12 15:11

Edmondo1984


1 Answers

Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.

MOXy is already the default JAXB implementation in WebLogic 12.1.1:

  • http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb-provider-in.html

In other environments you could also leverage the META-INF/services mechanism to specify MOXy as the default JAXB provider:

  1. Create a JAR that contains a file called javax.xml.bind.JAXBContext in the directory META-INF/services
  2. The contents of the javax.xml.bind.JAXBContext file must be org.eclipse.persistence.jaxb.JAXBContextFactory
  3. Add that jar to your classpath.
like image 163
bdoughan Avatar answered Oct 20 '22 05:10

bdoughan