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")
|
||||
public class SFTPConfig {
|
||||
protected Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ExportSwtServiceSettings settings;
|
||||
|
||||
public SFTPConfig(ExportSwtServiceSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Bean("sftpSessionFactory")
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory() {
|
||||
public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory(ExportSwtServiceSettings settings) {
|
||||
DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
|
||||
factory.setHost(settings.getSftpOut().getServerIp());
|
||||
factory.setPort(settings.getSftpOut().getServerPort());
|
||||
|
|
@ -52,7 +47,8 @@ public class SFTPConfig {
|
|||
|
||||
@Bean("sftpHandler")
|
||||
@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);
|
||||
handler.setRemoteDirectoryExpression(new LiteralExpression(settings.getSftpOut().getSftpOutDir()));
|
||||
log.info("Configure sftp output directory \"{}\"", settings.getSftpOut().getSftpOutDir());
|
||||
|
|
@ -69,7 +65,8 @@ public class SFTPConfig {
|
|||
|
||||
@Bean("sftpHandlerList")
|
||||
@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());
|
||||
return new SftpOutboundGateway(sessionFactory, LS.getCommand(), expression);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue