如果 /WEB-INF/lib 目录的类路径中同时有 jackson-jaxrs-json-provider 和 jersey-media-json-binding.jar 会发生什么?
我正在开发一个由 Apache ant 构建器管理的 Web 应用程序。我们最近将 jersey 从 2.17 升级到 2.35 以及类路径中的所有相关依赖项。升级后,我注意到一个错误,其中 PSOT 方法参数填充为 null。
做了一些挖掘来解决这个问题,发现 jersey-media-json-binding.jar 可能会导致这个问题。将其从类路径中删除,一切正常。
但我无法弄清楚为什么会导致这个问题,这个 jersey-media-json-binding.jar 库有什么用。
jersey-media-json-binding.jar 和 jackson-jaxrs-json-provider-2.12.2.jar 是否提供相同的功能,从而导致问题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是新的默认提供商。如果您在classPath上(没有其他提供商的明确注册),则将使用。默认情况曾经为。如果您想要 jackson> jackson> jackson 要使用无论哪个提供商在类路径上,只需在您的应用程序上注册
JacksonFeature
。所有这三个提供者都用于JSON支持,但是在(DE)序列化方面都有不同的行为。另外,所有这些提供商模块都有自动注册,这意味着您不必明确注册它们。但是,是预定义的行为,即将优先考虑哪个行为(如果存在多个)。因此,如果您希望使用特定的特定方法,无论哪个在类路径上,只需注册其功能(即JacksonFeature
,jsonbindingfeature
,moxyjsonFeature
)。JSON-B is the new default provider. If you have it on the classpath (without explicit registration of other providers), it will be used. The default used to be MOXy. If you want Jackson to be used regardless of which provider is on the classpath, just register the
JacksonFeature
with your application. All three of these providers are used for JSON support, but they all have different behaviors in regards to (de)serialization. Also, all of these provider modules have auto-registration, meaning you don't have to explicitly register them. But there is predefined behavior as to which one will take priority (if more than one is present). So if you want a specific one to be used, regardless of which are on the classpath, just register its feature (i.e.JacksonFeature
,JsonBindingFeature
,MoxyJsonFeature
).