该版本仍在开发中,尚未被视为稳定。对于最新的稳定版本,请使用 Spring Integration 7.0.0spring-doc.cadn.net.cn

SFTP适配器

Spring Integration 支持通过 SFTP 传输文件作。spring-doc.cadn.net.cn

安全文件传输协议(SFTP)是一种网络协议,允许您通过任何可靠的流在互联网上的两台计算机之间传输文件。spring-doc.cadn.net.cn

SFTP协议要求安全通道,如SSH,并且在整个SFTP会话中对客户端身份保持可见性。spring-doc.cadn.net.cn

Spring Integration通过提供三个客户端端端点:入站通道适配器、出站通道适配器和出站网关,支持通过SFTP发送和接收文件。 它还提供了方便的命名空间配置以定义这些客户端组件。spring-doc.cadn.net.cn

从6.0版本开始,过时的JCraft JSch客户端已被现代Apache MINA SSHD框架取代。 这导致框架组件出现了许多破坏性的变更。 然而,在大多数情况下,这种迁移隐藏在 Spring Integration API 之后。 最剧烈的变化发生在DefaultSftpSessionFactory该理论现在基于org.apache.sshd.client.SshClient并暴露了其一些配置性质。

你需要把这种依赖性纳入你的项目中:spring-doc.cadn.net.cn

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-sftp</artifactId>
    <version>6.3.12-SNAPSHOT</version>
</dependency>
compile "org.springframework.integration:spring-integration-sftp:6.3.12-SNAPSHOT"

要在XML配置中包含SFTP命名空间,请在根元素上添加以下属性:spring-doc.cadn.net.cn

xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
    https://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd"