我只想学习自定义转换器并遇到问题。任何帮助深表感谢。Camel 2.17 版和 JBoss Fuse 6.3
@Converter
public class MyConvertor{
public MyConvertor(){}
@Converter
public static String convertTo(Exchange exchange) {}
}
在我的 Spring DSL 中
<convertBodyTo charset="UTF-8" id="_convertBodyTo1" type="com.x.convertor.MyConvertor"/>
在 META-INF/services/org/apache/camel/TypeConverter
com.x.convertor.MyConvertor
错误信息 :
org.apache.camel.InvalidPayloadException: No body available of type: com.x.convertor.MyConvertor but has value: GenericFile[output.txt] of type: org.apache.camel.component.file.GenericFile on: output.txt. Caused by: No type converter available to convert from type:
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.file.GenericFile to the required type: com.x.convertor.MyConvertor