apache-camel - Camel rest JSON 使用 START_ARRAY 反序列化
问题描述
我正在尝试将application/json
休息服务转换为 POJO 列表。但我不能
我的输入是我无法引用列表的列表Event
。camel:put
<dataFormats>
<json id="eventJsonList" prettyPrint="true" library="Jackson" useList="true"
unmarshalTypeName="example.model.Event" />
</dataFormats>
<camel:rest path="events" consumes="application/json" produces="application/json">
<camel:put
uri="/save">
<to uri="direct:save-events" />
</camel:put>
</camel:rest>
使用Camel 2.22
解决方案
我认为您需要使用camel:unmarshall
来告诉路线使用您的数据格式。
<camel:rest path="events" consumes="application/json" produces="application/json">
<camel:put uri="/save">
<camel:route>
<camel:unmarshal ref="eventJsonList" />
<camel:to uri="direct:save-events" />
</camel:route>
</camel:put>
</camel:rest>
推荐阅读
- ios - X 轴动作奇怪 - 图表 iOS
- java - 快速关闭等效的java lambda
- r - 如何在 R 中的 Plotly 中使直方图条具有不同的颜色
- laravel - 根据子存在和列值过滤多对多关系
- get - 使用 API 获取 Dailymotion 视频与 Dailymotion 本身完全相同的顺序
- jquery - 如何比较和匹配来自不同元素的字符串?
- python - Pandas 在同一个表中合并多个列,产生意外的输出
- regex - 正则表达式仅匹配关键字
- javascript - 仅选择javascript中的输入字段
- spring - Spring Cloud Kubernetes FeignClient 错误