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"