0
votes

I am trying to use Spring Integration to set up the remoteDirectoryExpression, below code I set it up to "headers.['remote_dir']". However, it shows below error. How can I write the spEl to make it work? Thanks.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOut' defined in class path resource [com/carrotit/ca/config/SpringIntegrationFtp.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.integration.dsl.IntegrationFlow]: Factory method 'ftpOut' threw exception; nested exception is org.springframework.expression.spel.SpelParseException: EL1049E:(pos 7): Unexpected data after '.': 'lsquare([)'

=============the code=====================

    @Bean
    public IntegrationFlow ftpOut() {

//      String remoteDirectory = "/root/sub/subfolder/";
        String remoteDirectoryExpression ="headers.['remote_dir']";

        return IntegrationFlows.from(messageChannel())
                .handle(Ftp.outboundAdapter(sessionFactory(), FileExistsMode.REPLACE).remoteDirectoryExpression(remoteDirectoryExpression)
                        .autoCreateDirectory(true))
                .get();

    }
1

1 Answers

0
votes

Remove the period; it's

"headers['remote_dir']";

See the SpEL reference.