membersound
membersound

Reputation: 86875

How to set the target directory in FtpMessageHandler?

How can I set the target directory in FtpMessageHandler, if not as follows?

@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler handler() {
    FtpMessageHandler handler = new FtpMessageHandler(ftpSessionFactory());
    handler.setRemoteDirectoryExpressionString("/my/remote/dir");
    return handler;
}

Result:

Caused by: org.springframework.expression.spel.SpelParseException: Expression [/my/remote/ftp] @0: EL1070E: Problem parsing left operand

Upvotes: 0

Views: 390

Answers (1)

Gary Russell
Gary Russell

Reputation: 174739

When setting the expression to a literal value, you must include the literal within single quotes.

handler.setRemoteDirectoryExpressionString("'/my/remote/dir'");

It's an expression so you can dynamically determine the destination directory.

Upvotes: 1

Related Questions