|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
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; |
|
|
|
@ -28,4 +29,22 @@ public class SftpConfig { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |