52.5. 使用动态类名称从 XML 迁移到 POJO
如果您使用 jackson unmarshal XML 到 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>