46.5. 使用动态类名称从 XML 到 POJO 的 unmarshaling
如果您使用 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>