feature:FTP 修订

release
gaorl 2 years ago
parent f792cedeff
commit 01be6f3630
  1. 1
      dxhy-oss/src/main/java/com/dxhy/oss/service/FtpService.java
  2. 1
      dxhy-oss/src/main/java/com/dxhy/oss/service/SshService.java
  3. 19
      dxhy-oss/src/main/java/com/dxhy/oss/utils/SftpConfig.java
  4. 1
      dxhy-oss/src/main/java/com/dxhy/oss/utils/SftpProperties.java

@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@Service
public class FtpService { public class FtpService {
private final SftpPool pool; private final SftpPool pool;

@ -15,7 +15,6 @@ import java.nio.file.Files;
* @author jiaohongyang * @author jiaohongyang
*/ */
@Slf4j @Slf4j
@Service
public class SshService { public class SshService {
private final SshPool pool; private final SshPool pool;

@ -1,6 +1,7 @@
package com.dxhy.oss.utils; package com.dxhy.oss.utils;
import com.dxhy.oss.service.FtpService; import com.dxhy.oss.service.FtpService;
import com.dxhy.oss.service.SshService;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -28,4 +29,22 @@ public class SftpConfig {
return new FtpService(sftpPool); return new FtpService(sftpPool);
} }
// 工厂
@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);
}
} }

@ -1,6 +1,5 @@
package com.dxhy.oss.utils; package com.dxhy.oss.utils;
import com.jcraft.jsch.ChannelSftp;
import lombok.Data; import lombok.Data;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.apache.commons.pool2.impl.GenericObjectPoolConfig;

Loading…
Cancel
Save