使用Spring框架的Ftp文件传输

使用Spring框架的Ftp文件传输,ftp,spring-integration,Ftp,Spring Integration,我试图用Spring上传文件,但我遇到了我不理解的问题 以下是我对适配器和会话工厂的定义: <bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <property name="host" value="127.0.0.1"/> <property name="port" val

我试图用Spring上传文件,但我遇到了我不理解的问题

以下是我对适配器和会话工厂的定义:

<bean id="ftpClientFactory"
        class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    <property name="host" value="127.0.0.1"/>
    <property name="port" value="21"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
    <property name="clientMode" value="0"/>
</bean>

<si:channel id="ftpChannel"/>

<int-ftp:outbound-channel-adapter id="ftpOutbound"
                                  channel="ftpChannel"
                                  remote-directory="/Users/testUser"
                                  session-factory="ftpClientFactory"/>

知道我做错了什么吗?谢谢您的建议。

看起来您应该将
缓存会话=“true”
添加到

配置


但从另一方面看,SpringIntegration2.1是一个非常旧的版本,它已经是EOL了。如果切换到最新版本会更好:

我添加了缓存会话并切换到最新版本的spring integration,现在我遇到了以下错误:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:class path resource[citrus context.xml]的xml文档中的第553行无效;嵌套异常为org.xml.sax.saxpasseeption;系统ID:;行号:553;栏目号:71;src resolve:无法将名称“integration:smartLifeCycleAttributeGroup”解析为(n)“属性组”组件。您应该升级所有Spring integration JAR,并将Spring Nature的IDE配置为从类路径而不是Internet解析XSD。自2.2版起,缓存会话已被删除。对于最新版本,您只需围绕目标
sessionfactory
配置
CachingSessionFactory
即可实现缓存功能。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOutbound': Cannot resolve reference to bean 'org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.file.remote.handler.FileTransferringMessageHandler#0': Cannot create inner bean '(inner bean)' of type [org.springframework.integration.file.remote.session.SessionFactoryFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)': Unsatisfied dependency expressed through constructor argument with index 1 of type [boolean]: Could not convert constructor argument value of type [java.lang.String] to required type [boolean]: Failed to convert value of type 'java.lang.String' to required type 'boolean'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value []