我有一个@InboundChannelAdapter,它从文件系统读取文件,我应该将它们发送到Transformer,该Transformer会将文件从Message
这是代码
@Bean
@InboundChannelAdapter(value = "importProcessChannel", poller = @Poller(fixedDelay = "1000"))
public MessageSource<File> importFileComparatorMessageSource() {
FileReadingMessageSource source = new FileReadingMessageSource();
source.setDirectory(new File("C:\\FileTest"));
CompositeFileListFilter<File> filterList = new CompositeFileListFilter<File>();
filterList.addFilter(new SimplePatternFileListFilter("*.txt"));
source.setFilter(filterList);
return source;
}
@Bean
@Transformer(inputChannel = "importProcessChannel" , outputChannel = "splitFileChannel")
public Message<Filecontent> handleImportFile(Message<File>importFileMsg) {
Filecontent rows = null;
Message<Filecontent> msf = null;
return msf;
}
启动应用程序时出现以下错误
Unsatisfied dependency expressed through method 'handleImportFile' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.messaging.Message<java.io.File>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
有人可以帮我吗? 非常感谢
答案 0 :(得分:1)
从@Bean
中删除@Transformer
。