FTP/FTPS 适配器

Spring Integration 提供了对使用 FTP 和 FTPS 进行文件传输操作的支持。

文件传输协议 (FTP) 是一种简单的网络协议,允许您在互联网上的两台计算机之间传输文件。FTPS 代表“FTP over SSL”。

您需要在您的项目中包含此依赖项

  • Maven

  • Gradle

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-ftp</artifactId>
    <version>6.4.4</version>
</dependency>
compile "org.springframework.integration:spring-integration-ftp:6.4.4"

当涉及到 FTP 通信时,有两个角色:客户端和服务器。要使用 FTP 或 FTPS 传输文件,您需要使用客户端发起连接到运行 FTP 服务器的远程计算机。连接建立后,客户端可以选择发送或接收文件的副本。

Spring Integration 通过提供三种客户端端点来支持通过 FTP 或 FTPS 发送和接收文件:入站通道适配器、出站通道适配器和出站网关。它还提供了方便的基于命名空间的配置选项来定义这些客户端组件。

要使用 FTP 命名空间,请将以下内容添加到 XML 文件的头部

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