作为解决方法,我重构了代码,放弃了文件适配器:
@Beanpublic IntegrationFlow ftpInboundFlow() { return IntegrationFlows .from(source -> source.ftp(ftpSessionFactory()).deleteRemoteFiles(true).preserveTimestamp(true) .filter(compositeWithAcceptonceFilter()) .remoteDirectory(ftpProperties.getRemoteDirectory()) .localDirectory(new File(ftpProperties.getLocalDirectory())).autoCreateLocalDirectory(true), consumer -> consumer.id("ftpInboundAdapter")) .handle(new GenericHandler<File>() { @Override @Transactional public Object handle(File payload, Map<String, Object> headers) { logger.debug("Data arrived {} {}", payload, payload.getClass().getName()); File dstFile = new File("archive", payload); FileUtils.moveFile(payload, dstFile); return dstFile; } }) .handleWithAdapter(a -> a.ftp(ftpSessionFactory()) .remoteDirectory(ftpProperties.getRemoteArchiveDirectory()).autoCreateDirectory(true)).get();}



