fix circular dependency

This commit is contained in:
etreschenkov 2024-06-07 17:13:05 +03:00
parent ed3a6d31f0
commit 88db266d26

View file

@ -5,7 +5,6 @@ import java.util.List;
import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.ChannelSftp;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
@ -27,15 +26,9 @@ import ru.spcex.clearing.dbf.importer.config.settings.ImportDBFServiceSettings;
@Configuration @Configuration
public class SFTPConfig { public class SFTPConfig {
private final Logger log = LoggerFactory.getLogger(getClass()); private final Logger log = LoggerFactory.getLogger(getClass());
private final ImportDBFServiceSettings settings;
@Autowired
public SFTPConfig(ImportDBFServiceSettings settings) {
this.settings = settings;
}
@Bean @Bean
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory() { public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ImportDBFServiceSettings settings) {
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true); DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
factory.setHost(settings.getStore().getSftpIn().getServerIp()); factory.setHost(settings.getStore().getSftpIn().getServerIp());
factory.setPort(settings.getStore().getSftpIn().getServerPort()); factory.setPort(settings.getStore().getSftpIn().getServerPort());