0

When my FTP mput transfer is successfully complete, I want to rename the file in the local directory. For this, I need to use the local dir path from PropertyPlaceholderConfigurer. But this doesn't seem to be working. Please can you suggest the syntaxt to expand the value of the property? ${local.request.dir} represents a directory path like /home/jainr/REQUEST.

<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>
curious_brain
  • 391
  • 2
  • 17
  • Possible duplicate of [How does Spring 3 expression language interact with property placeholders?](http://stackoverflow.com/questions/2041558/how-does-spring-3-expression-language-interact-with-property-placeholders) – benbenw Nov 26 '15 at 21:32
  • That question is talking only about initialization-time SpEL; this is runtime SpEL. – Gary Russell Nov 27 '15 at 13:59

1 Answers1

2

You need to define the resolved placeholder as a literal, from a SpEL perspective...

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

Notice I also removed the #{...} - that is initialization time SpEL - this is runtime SpEL.

In future, instead of statements like...

But this doesn't seem to be working.

...provide the error message and/or stack trace.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179