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.0.0</version>
</dependency>
compile "org.springframework.integration:spring-integration-sftp:7.0.0"
要在您的 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"