You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
774 B
31 lines
774 B
2 years ago
|
package com.dxhy.oss.utils;
|
||
|
|
||
|
import com.dxhy.oss.service.FtpService;
|
||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||
|
import org.springframework.context.annotation.Bean;
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
||
|
// ftp配置
|
||
|
@Configuration
|
||
|
@EnableConfigurationProperties(SftpProperties.class)
|
||
|
public class SftpConfig {
|
||
|
|
||
|
// 工厂
|
||
|
@Bean
|
||
|
public SftpFactory sftpFactory(SftpProperties properties) {
|
||
|
return new SftpFactory(properties);
|
||
|
}
|
||
|
|
||
|
// 连接池
|
||
|
@Bean
|
||
|
public SftpPool sftpPool(SftpFactory sftpFactory) {
|
||
|
return new SftpPool(sftpFactory);
|
||
|
}
|
||
|
|
||
|
// 辅助类
|
||
|
@Bean
|
||
|
public FtpService ftpService(SftpPool sftpPool) {
|
||
|
return new FtpService(sftpPool);
|
||
|
}
|
||
|
|
||
|
}
|