outbound-gateway和出站通道适配器出错

时间:2018-04-22 03:49:10

标签: spring-integration

在使用 spring-integration-samples 项目中的代码并尝试实施以下流程时:

read_file-> backup_file-> transform_file-> WRITE_FILE

  • ' READ_FILE'是file:inbound-channel-adapter
  • ' backup_file'是服务激活者'调用java服务(执行复制文件)
  • ' transform_file'是2变形金刚
  • ' WRITE_FILE'是文件:正在写入已处理文件的出站通道适配器

在我尝试实施' backup_file'之前,一切正常。步骤作为文件:出站网关
我收到了错误:

  

加载fileCopyDemo文件时出错,因为没有符合条件的bean' org.springframework.integration.file.FileWritingMessageHandler' available:期望的单个匹配bean但找到2:org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#0,org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#1


这是我的配置:

<!--read_file-->
<int-file:inbound-channel-adapter auto-startup="true" id="filesIn" channel="filesBackup"
        directory="${int.uvrp.original}" 
        filter="compositeFileFilter" >
        <int:poller id="poller" max-messages-per-poll="10" cron="*/10 * * * * *" default="true" />
</int-file:inbound-channel-adapter>

<!--backup_file-->
<int-file:outbound-gateway id="backupGate" request-channel="filesBackup" reply-channel="filesProcessing" directory="file:${int.archive}" />

<!--transform_file-->
<int-file:file-to-bytes-transformer input-channel="filesProcessing" output-channel="bytes" />
<int:transformer input-channel="bytes" output-channel="filesStore" ref="myTransformer1" method="transform" />

<!--write_file-->
<int-file:outbound-channel-adapter id="filesOut" channel="filesStore" directory="${int.processed}" delete-source-files="true"/>


有什么想法吗?

1 个答案:

答案 0 :(得分:0)

感谢您的提示。我从头开始创建项目,复制配置文件,一切都按预期工作。