使用Moxy作为默认的JAXB实现 [英] Use Moxy as default JAXB Implementation

查看:162
本文介绍了使用Moxy作为默认的JAXB实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了使用Moxy作为JAXB实现,必须在包含应用程序的域类的文件夹中添加一个名为jaxb.properties的文件,并包含以下行

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

是否可以将moxy设为项目的默认值?如果我有许多不同的带有注释域类的文件夹,我应该在哪个文件夹中放置这个文件?

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?

推荐答案

注意: 我是 EclipseLink JAXB(MOXy) 的负责人和成员 JAXB(JSR-222) 专家组。

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

MOXy已经是WebLogic 12.1.1中的默认JAXB实现:

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

在其他环境中,您还可以利用 META- INF / services 将MOXy指定为默认JAXB提供程序的机制:

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


  1. 创建一个包含名为的文件的JAR目录 META-IN中的 javax.xml.bind.JAXBContext F / services

  2. javax.xml.bind.JAXBContext 文件的内容必须 org.eclipse.persistence.jaxb.JAXBContextFactory

  3. 将该jar添加到类路径中。

  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.

这篇关于使用Moxy作为默认的JAXB实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆