2015-11-26 48 views
0

当我的FTP mput传输成功完成时,我想重命名本地目录中的文件。为此,我需要使用PropertyPlaceholderConfigurer中的本地目录路径。但这似乎并没有奏效。请你可以建议合成文本扩大该物业的价值? $ {local.request.dir}表示像/ home/jainr/REQUEST这样的目录路径。以Spring表达式语言使用属性占位符

<int-ftp:request-handler-advice-chain> 
<bean id="requestFileRename" class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice"> 
    <property name="trapException" value="true" /> 
    <property name="onSuccessExpression" value="T(org.apache.commons.io.FileUtils).moveFile(new java.io.File(#{${local.request.dir}} + '/' + headers['RequestFileName']), new java.io.File(#{${local.request.dir}} + '/' + headers['RequestFileName'] + '.processed'))" /> 
</bean> 
</int-ftp:request-handler-advice-chain> 
+0

[Spring 3表达式语言如何与属性占位符交互?](http://stackoverflow.com/questions/2041558/how-does-spring-3-expression-language-interact-with-property-占位符) – benbenw

+0

该问题只涉及初始化时间SpEL;这是运行时SpEL。 –

回答

1

您需要定义解决占位符为文字,从规划环境地政司的角度...

new java.io.File('${local.request.dir}/' + headers... 

注意我还删除了#{...} - 即初始化时间规划环境地政司 - 这是运行规划环境地政司。

在未来,而不是陈述喜欢...

但这似乎并不奏效。

...提供错误消息和/或堆栈跟踪。