From 3bb9d43161e62ed9c554c04b6136f9ef2d1ce517 Mon Sep 17 00:00:00 2001 From: gaorl Date: Tue, 13 Jun 2023 16:13:18 +0800 Subject: [PATCH] =?UTF-8?q?feature=EF=BC=9Afpt=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dxhy/oss/utils/SshConfig.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 dxhy-oss/src/main/java/com/dxhy/oss/utils/SshConfig.java diff --git a/dxhy-oss/src/main/java/com/dxhy/oss/utils/SshConfig.java b/dxhy-oss/src/main/java/com/dxhy/oss/utils/SshConfig.java new file mode 100644 index 00000000..54be88b4 --- /dev/null +++ b/dxhy-oss/src/main/java/com/dxhy/oss/utils/SshConfig.java @@ -0,0 +1,31 @@ +package com.dxhy.oss.utils; + +import com.dxhy.oss.service.FtpService; +import com.dxhy.oss.service.SshService; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +// ftp配置 +@Configuration +@EnableConfigurationProperties(SshProperties.class) +public class SshConfig { + // 工厂 + @Bean + public SshFactory sshFactory(SshProperties properties) { + return new SshFactory(properties); + } + + // 连接池 + @Bean + public SshPool sshPool(SshFactory sshFactory) { + return new SshPool(sshFactory); + } + + // 辅助类 + @Bean + public SshService sshService(SshPool sftpPool) { + return new SshService(sftpPool); + } + +} \ No newline at end of file