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

FTP/FTPS适配器

Spring Integration 支持通过 FTP 和 FTPS 进行文件传输作。spring-doc.cadn.net.cn

文件传输协议(FTP)是一种简单的网络协议,允许您在互联网上的两台计算机之间传输文件。FTPS 代表“基于 SSL 的 FTP”。spring-doc.cadn.net.cn

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

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

在FTP通信中,有两个参与者:客户端和服务器。要用FTP或FTPS传输文件,你需要使用客户端发起连接到运行FTP服务器的远程计算机。连接建立后,客户端可以选择发送或接收文件副本。spring-doc.cadn.net.cn

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

要使用 FTP 命名空间,请在 XML 文件的头部添加以下内容:spring-doc.cadn.net.cn

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"