Apache camel 将InputStreamCache转换为POJO
我正在尝试将Apache camel 将InputStreamCache转换为POJO,apache-camel,unmarshalling,jbossfuse,Apache Camel,Unmarshalling,Jbossfuse,我正在尝试将JSON响应(采用InputStreamCache格式)转换为Apache Camel中的POJO,如下所示: <convertBodyTo type="com.temp.MyPojo"/> 是否有任何方法可以使用convertBodyTo组件直接将StreamCache负载转换为POJO?我不想写一个显式转换器。 注意:我知道unmarshal组件。我想确认是否可以使用convertBodyTo实现相同的功能 您需要添加camel-jackson作为依赖项,因为如果
JSON
响应(采用InputStreamCache
格式)转换为Apache Camel中的POJO,如下所示:
<convertBodyTo type="com.temp.MyPojo"/>
是否有任何方法可以使用convertBodyTo组件直接将StreamCache
负载转换为POJO?我不想写一个显式转换器。
注意:我知道
unmarshal
组件。我想确认是否可以使用convertBodyTo
实现相同的功能 您需要添加camel-jackson作为依赖项,因为如果打开它,它能够从JSon负载转换为POJO
请参阅将Jackson与Camel的TypeConverter集成一节
No body available of type: model.so.response.MyResponse but has value:
org.apache.camel.converter.stream.InputStreamCache@3a689bf8 of type:
org.apache.camel.converter.stream.InputStreamCache on: Message: [Body is
instance of org.apache.camel.StreamCache]. Caused by: No type converter
available to convert from type:
org.apache.camel.converter.stream.InputStreamCache to the required type:
model.so.response.MyResponse with value
org.apache.camel.converter.stream.InputStreamCache@3a689bf8.
Exchange[Message: [Body is instance of org.apache.camel.StreamCache]].
Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type
converter available to convert from type:
org.apache.camel.converter.stream.InputStreamCache to the required type:
model.so.response.MyResponse with value
org.apache.camel.converter.stream.InputStreamCache@3a689bf8]