抱歉耽搁了; 我们这周在SpringOne平台上。
问题是由于网关规范是一个bean的事实-网关最终在应用建议之前被初始化。
我这样更改了您的代码…
@Beanpublic IntegrationFlow downloadFiles(SessionFactory<FTPFile> sessionFactory) { return f -> f.handle(getRemoteFile(sessionFactory), getRetryAdvice()) .channel("gatewayDownloadsOutputChannel");}...private RemoteFileOutboundGatewaySpec<FTPFile, FtpOutboundGatewaySpec> getRemoteFile(SessionFactory<FTPFile> sessionFactory) { return Ftp.outboundGateway(sessionFactory, AbstractRemoteFileOutboundGateway.Command.GET, "payload") .fileExistsMode(FileExistsMode.REPLACE) .localDirectoryexpression("'/tmp'") .autoCreateLocalDirectory(true);}
…而且有效。
通常最好不要直接处理Specs,而只是将它们内联到流定义中…
@Beanpublic IntegrationFlow downloadFiles(SessionFactory<FTPFile> sessionFactory) { return f -> f.handle(Ftp.outboundGateway(sessionFactory, AbstractRemoteFileOutboundGateway.Command.GET, "payload") .fileExistsMode(FileExistsMode.REPLACE) .localDirectoryexpression("'/tmp'") .autoCreateLocalDirectory(true), getRetryAdvice()) .channel("gatewayDownloadsOutputChannel");}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)