搜索

46.5. 使用动态类名称从 XML 到 POJO 的 unmarshaling

download PDF

如果您使用 jackson to unmarshal XML to POJO,那么您现在可以在消息中指定标头,以指示哪个类名称到 unmarshal。
如果消息中存在该标头,则标头的键为 CamelJacksonUnmarshalType,则 Jackson 会将该标头用作 POJO 类的 FQN,以免于 XML 有效负载。

 For JMS end users there is the JMSType header from the JMS spec that
indicates that also. To enable support for JMSType you would need to
turn that on, on the jackson data format as shown:
JacksonDataFormat format = new JacksonDataFormat();
format.setAllowJmsType(true);

或者来自 XML DSL,将其配置为

    <dataFormats>
      <jacksonxml id="jacksonxml" allowJmsType="true"/>
    </dataFormats>
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.