From 78b09ed6102f1ca1a203e3a5d75220334257427e Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 18 Sep 2023 16:32:49 -0400 Subject: [PATCH] GH-8713: Add support for custom `SftpClient` Fixes https://github.com/spring-projects/spring-integration/issues/8713 * Introduce `DefaultSftpSessionFactory.createSftpClient()` factory method which can be overridden for any custom `SftpClient` use-case * Add changes to the docs * Some code clean up **Cherry-pick to `6.1.x`** # Conflicts: # spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java # src/reference/antora/modules/ROOT/pages/sftp/session-factory.adoc # src/reference/antora/modules/ROOT/pages/whats-new.adoc --- .../session/DefaultSftpSessionFactory.java | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java index 7ad8b73e95..485585b041 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java @@ -53,6 +53,10 @@ import org.springframework.util.Assert; /** * Factory for creating {@link SftpSession} instances. + *

+ * The {@link #createSftpClient(ClientSession, SftpVersionSelector, SftpErrorDataHandler)} + * can be overridden to provide a custom {@link SftpClient}. + * The {@link ConcurrentSftpClient} is used by default. * * @author Josh Long * @author Mario Gray @@ -64,6 +68,7 @@ import org.springframework.util.Assert; * @author Artem Bilan * @author Krzysztof Debski * @author Auke Zaaiman + * @author Adama Sorho * * @since 2.0 */ @@ -279,9 +284,7 @@ public class DefaultSftpSessionFactory implements SessionFactory