如果 /WEB-INF/lib 目录的类路径中同时有 jackson-jaxrs-json-provider 和 jersey-media-json-binding.jar 会发生什么?

发布于 2025-01-17 07:49:07 字数 363 浏览 3 评论 0 原文

我正在开发一个由 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 是否提供相同的功能,从而导致问题?

I am working on a web application managed by Apache ant builder. We recently upgraded jersey from 2.17 to 2.35 and all the related dependencies in the class path. After upgrading i noticed one error where the PSOT method argument is populated as null.

Did some digging to solve this issue, found jersey-media-json-binding.jar might be causing the issue. Removed it from class path, and everything works fine.

But I am unable to figure why did the issue cause in the first place, what is the use of this jersey-media-json-binding.jar library.

Does jersey-media-json-binding.jar and jackson-jaxrs-json-provider-2.12.2.jar provide the same functionality, which is causing the issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天的雪花 2025-01-24 07:49:07

是新的默认提供商。如果您在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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文