fix bug when spring app don't up by circular reference error
This commit is contained in:
parent
dcc0a3c7ce
commit
5fb1b0526d
1 changed files with 5 additions and 8 deletions
|
|
@ -33,14 +33,9 @@ import ru.spcex.clearing.swt.exporter.config.settings.ExportSwtServiceSettings;
|
||||||
@ConditionalOnProperty(value="export-swt-service.sftp-out.sftp-out-dir")
|
@ConditionalOnProperty(value="export-swt-service.sftp-out.sftp-out-dir")
|
||||||
public class SFTPConfig {
|
public class SFTPConfig {
|
||||||
protected Logger log = LoggerFactory.getLogger(getClass());
|
protected Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final ExportSwtServiceSettings settings;
|
|
||||||
|
|
||||||
public SFTPConfig(ExportSwtServiceSettings settings) {
|
|
||||||
this.settings = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("sftpSessionFactory")
|
@Bean("sftpSessionFactory")
|
||||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory() {
|
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ExportSwtServiceSettings settings) {
|
||||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||||
factory.setHost(settings.getSftpOut().getServerIp());
|
factory.setHost(settings.getSftpOut().getServerIp());
|
||||||
factory.setPort(settings.getSftpOut().getServerPort());
|
factory.setPort(settings.getSftpOut().getServerPort());
|
||||||
|
|
@ -52,7 +47,8 @@ public class SFTPConfig {
|
||||||
|
|
||||||
@Bean("sftpHandler")
|
@Bean("sftpHandler")
|
||||||
@ServiceActivator(inputChannel = "toSftpChannel")
|
@ServiceActivator(inputChannel = "toSftpChannel")
|
||||||
public MessageHandler handler(@Qualifier("sftpSessionFactory") SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
public MessageHandler handler(@Qualifier("sftpSessionFactory") SessionFactory<ChannelSftp.LsEntry> sessionFactory,
|
||||||
|
ExportSwtServiceSettings settings) {
|
||||||
SftpMessageHandler handler = new SftpMessageHandler(sessionFactory);
|
SftpMessageHandler handler = new SftpMessageHandler(sessionFactory);
|
||||||
handler.setRemoteDirectoryExpression(new LiteralExpression(settings.getSftpOut().getSftpOutDir()));
|
handler.setRemoteDirectoryExpression(new LiteralExpression(settings.getSftpOut().getSftpOutDir()));
|
||||||
log.info("Configure sftp output directory \"{}\"", settings.getSftpOut().getSftpOutDir());
|
log.info("Configure sftp output directory \"{}\"", settings.getSftpOut().getSftpOutDir());
|
||||||
|
|
@ -69,7 +65,8 @@ public class SFTPConfig {
|
||||||
|
|
||||||
@Bean("sftpHandlerList")
|
@Bean("sftpHandlerList")
|
||||||
@ServiceActivator(inputChannel = "listSftpChannel")
|
@ServiceActivator(inputChannel = "listSftpChannel")
|
||||||
public MessageHandler handlerList(@Qualifier("sftpSessionFactory") SessionFactory<ChannelSftp.LsEntry> sessionFactory) {
|
public MessageHandler handlerList(@Qualifier("sftpSessionFactory") SessionFactory<ChannelSftp.LsEntry> sessionFactory,
|
||||||
|
ExportSwtServiceSettings settings) {
|
||||||
String expression = "'/%s'".formatted(settings.getSftpOut().getSftpOutDir());
|
String expression = "'/%s'".formatted(settings.getSftpOut().getSftpOutDir());
|
||||||
return new SftpOutboundGateway(sessionFactory, LS.getCommand(), expression);
|
return new SftpOutboundGateway(sessionFactory, LS.getCommand(), expression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue