JAXB 提供程序 Eclipselink MOXy 忽略 @XmlAccessorType(XmlAccessType.NONE)
我在 package-info.java
中为 my.package
使用 @XmlAccessorType(XmlAccessType.NONE)
,这意味着 JAXB 应该只关心带注释的元素。然而,当我使用简单 POJO MOXy 的 un/marshalling 代码运行 JUnit 测试时,只会以这种方式尖叫每个类(甚至来自没有 jaxb.properties 的包或来自依赖项中引用的其他 Maven 模块):
Exception Description: The class other.maven.module.package.class requires a zero argument constructor or a specified factory method. Note that non-static inner classes do not have zero argument constructors and are not supported.
我没有遇到过Metro 存在这样的问题(参考实现,但它对我的使用还有其他缺陷),不幸的是我真的无法以这种方式修改每个类。
I use @XmlAccessorType(XmlAccessType.NONE)
in package-info.java
for my.package
which means JAXB should care only about annotated elements. However, when I run my JUnit test with un/marshalling code for simple POJO MOXy just screams about every class (even from package without jaxb.properties or from other maven modules which are referenced in dependencies) in this manner:
Exception Description: The class other.maven.module.package.class requires a zero argument constructor or a specified factory method. Note that non-static inner classes do not have zero argument constructors and are not supported.
I haven't encountered such issue with Metro (reference implementation, but it has other defects for my usage) and unfortunately I really can't modify every class in this way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经能够验证这个问题,已输入以下错误来跟踪这个问题。
问题摘要:
对于以下对象模型:
并且:
EclipseLink MOXy JAXB 实现正在处理 Bar 类,尽管它不应该如此,因为它没有被映射。
I have been able to verify this issue, the following bug has been entered to track this issue.
Issue summary:
For the following object model:
and:
The EclipseLink MOXy JAXB implementation is processing the Bar class although it should not be, because it is not mapped.