【发布时间】:2019-02-22 15:21:09
【问题描述】:
我对 Apache Camel 很陌生,目前我正在制作一个测试项目。目前我正在尝试使用文件组件将一些以前处理过的对象从自定义类写入文件(我不知道更好的选择)。
from("direct:processedDecimals")
.to("file:data/output")
但我有以下问题
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: java.io.InputStream but has value: Add{x=5.63, y=78.016} of type: org.example.math.Add on: Message[ID-NTB828-1537281187742-0-10]. Caused by: No type converter available to convert from type: org.example.math.Add to the required type: java.io.InputStream with value Add{x=5.63, y=78.016}. Exchange[ID-NTB828-1537281187742-0-9]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: org.example.math.Add to the required type: java.io.InputStream with value Add{x=5.63, y=78.016}]
我在网上看到有人建议编写自定义 TypeConverter,然后将其注册到 WEB-INF 文件夹中的文件中。但是我使用的是 SpringBoot 及其内部的 Tomcat,我没有这个目录。
【问题讨论】:
标签: java apache spring-boot apache-camel integration