使用 Moxy 作为默认的 JAXB 实现 [英] Use Moxy as default JAXB Implementation
问题描述
为了使用 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:
在其他环境中,您还可以利用 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:
- 在目录
META-INF/services
中创建一个包含名为 javax.xml.bind.JAXBContext
文件的内容必须是org.eclipse.persistence.jaxb.JAXBContextFactory
- 将该 jar 添加到您的类路径中.
javax.xml.bind.JAXBContext
的文件的JAR- Create a JAR that contains a file called
javax.xml.bind.JAXBContext
in the directoryMETA-INF/services
- The contents of the
javax.xml.bind.JAXBContext
file must beorg.eclipse.persistence.jaxb.JAXBContextFactory
- Add that jar to your classpath.
这篇关于使用 Moxy 作为默认的 JAXB 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!