spring integration IntegrationFlow DSL for ftp



我试图使用Spring集成来设置remoteDirectoryExpression,下面的代码我将其设置为"headers.['remote_dir']"。然而,它显示了下面的错误。我怎么写咒语才能让它生效?谢谢。

org.springframework.beans.factory。在类路径资源[com/carrotit/ca/config/SpringIntegrationFtp.class]中创建名称为'ftpOut'的bean时出错:通过工厂方法实例化bean失败;[org.springframework.integration.dsl.IntegrationFlow]:工厂方法'ftpOut'抛出异常;嵌套异常是org.springframework.expression. spell . spelparseexception: EL1049E:(pos 7): '. error '之后的意外数据。":"lsquare(()"

============= 的代码 =====================

    @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();
    }

去掉句号;这是

"headers['remote_dir']";

参见SpEL参考

最新更新