Spring integration spring Integration在ftp中如何将文件发送到不同的子文件夹

Spring integration spring Integration在ftp中如何将文件发送到不同的子文件夹,spring-integration,spring-integration-sftp,Spring Integration,Spring Integration Sftp,我已使用以下配置将所有本地文件发送到目标ftp服务器文件夹: @Bean @ServiceActivator(inputChannel = FtpDef.FTP_OUTBOUND_CHANNEL) public MessageHandler handler() { FtpMessageHandler handler = new FtpMessageHandler(ftpSessionFactory()); handler.setRemoteDirectoryExpression(

我已使用以下配置将所有本地文件发送到目标ftp服务器文件夹:

@Bean
@ServiceActivator(inputChannel = FtpDef.FTP_OUTBOUND_CHANNEL)
public MessageHandler handler() {
    FtpMessageHandler handler = new FtpMessageHandler(ftpSessionFactory());
    handler.setRemoteDirectoryExpression(
            // only one path can be set here 
            new LiteralExpression("/path/on/ftp/"));
    return handler;
}
现在我需要将每个文件保存在一个目录结构中作为本地文件

e、 g

我想我怎样才能做到呢

新的文字表达式(“/path/on/ftp/”)

不要使用
文字表达式
,即,呃。。。文字

相反,请使用:

new SpelExpressionParser().parseExpression(rdExpression)
其中,
rdExpression
类似于

"'/path/on/ftp/' + payload.absolutePath"

嗨@Garry,我试着使用payload.absolutePath,但我得到了ioexception,它说无法写入路径。服务器回复为:553/base/b/b.txt。写入:没有这样的文件或目录。现在我已经解决了路径问题,我需要的是“自动创建目录”的java配置版本,我需要将其设置为true!但我不知道如何…
handler.setAutoCreateDirectory(true)
-请参阅。
"'/path/on/ftp/' + payload.absolutePath"