我可以用代码替换 jaxb.properties 吗?
我正在使用一些非标准扩展 来自 EclipseLink 的 JAXB 实现,为了启用该实现,我必须使用 jaxb.properties 来配置它。效果很好。
然而,由于构建错误,属性文件没有包含在正确的位置,导致使用默认的 JAXB,它没有任何错误,只是继续解析 XML 文件,忽略非标准扩展名,给我留下了一个非工作豆。
为了使其更加健壮,我想摆脱属性文件并在代码中指定上下文配置。由于 EclipseLink 的注释,我已经在编译时依赖了它们,并且我不需要在部署时配置这部分(事实上,看到可能出错的地方,我不希望它可配置)。
I am using some non-standard extensions from EclipseLink's implementation of JAXB, and to enable that implementation, I have to configure it using jaxb.properties. Works well.
However, due to a build error, the properties file was not included in the proper place, resulting in the default JAXB being used, which without any errors just continued to parse the XML file, ignoring the non-standard extension, leaving me with a non-working bean.
To make this more robust, I'd like to get rid off the properties file and specify the context configuration in code. I already have a compile-time dependency on EclipseLink because of their annotations, and I do not need this part configurable at deploy time (in fact, seeing what can go wrong, I do not want it configurable).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以执行以下操作来获取没有
jaxb.properties
文件的 EclipseLink JAXB (MOXy)JAXBContext
:You could do the following to get an EclipseLink JAXB (MOXy)
JAXBContext
without ajaxb.properties
file: