|
此版本仍在开发中,尚未被视为稳定版。如需最新稳定版本,请使用 Spring Integration 7.0.4! |
SFTP 支持
Spring Integration 提供了对通过 SFTP 进行文件传输操作的支持。
安全文件传输协议(SFTP)是一种网络协议,允许您通过任何可靠的流在互联网上的两台计算机之间传输文件。
SFTP 协议需要一个安全的通道(例如 SSH),并在整个 SFTP 会话中可见客户端的身份。
Spring Integration 通过提供三个客户端侧端点支持通过 SFTP 发送和接收文件:入站通道适配器、出站通道适配器和出站网关。 它还提供了便捷的命名空间配置,用于定义这些客户端组件。
从 6.0 版本开始,过时的 JCraft JSch 客户端已被现代化的 Apache MINA SSHD 框架所取代。
这导致框架组件发生了大量破坏性变更。
然而,在大多数情况下,此类迁移隐藏在 Spring Integration API 背后。
最剧烈的变化发生在 DefaultSftpSessionFactory 上,它现在基于 org.apache.sshd.client.SshClient 并暴露了其若干配置属性。 |
此依赖项是项目所必需的:
-
Maven
-
Gradle
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-sftp</artifactId>
<version>7.1.0-M3</version>
</dependency>
implementation "org.springframework.integration:spring-integration-sftp:7.1.0-M3"
要在您的 XML 配置中包含 SFTP 命名空间,请在根元素中包含以下属性:
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"