【发布时间】:2016-11-10 13:07:20
【问题描述】:
我是弹簧集成的新手。我请求帮助我解决这个问题。
我正在使用 sftp:outbound-gateway 将文件从一个文件夹移动到另一个文件夹。
文件夹结构为:
top-dir
- module-dir
- output-dir
filexyz.txt
- archive-dir
我想将 filexyz.txt 从输出移动到存档文件夹。
配置是:
<int-sftp:outbound-gateway
session-factory="ftpSessionFactory"
expression="payload.remoteDirectory + '/' + payload.filename"
request-channel="inChannel"
command="mv"
rename-expression="payload.remoteDirectory + '/' +
payload.filename.replaceFirst('output-dir','archive-dir')"
reply-channel="outChannel"/>
java代码:
DirectChannel moveChannel = context.getBean("inChannel",DirectChannel.class);
moveChannel.send(new GenericMessage<File>(new File("top-dir\module-dir\output-dir\filexyz.txt")));
我在how to replace string in SpEL expression? 提到了问题,但无法解决我的问题。
我收到表达式评估失败:payload.remoteDirectory + '/' + payload.filename 异常。
我认为我在 java 代码中做错了什么。
请帮帮我。
【问题讨论】: