2016-01-21 48 views
1

我一直在淘金的方式來設置使用註釋配置系統的SFTP出站網關。到目前爲止,我已經空了。春季集成SFTP上傳非XML配置

那麼有沒有辦法在Spring代碼的幫助下在Java代碼中配置以下XML?

<int-sftp:outbound-gateway id="gatewayLS" 
          session-factory="sftpSessionFactory" 
          request-channel="inbound" 
          command="ls" 
          command-options="" 
          expression="payload" 
          reply-channel="toSplitter"/> 

回答

0

由於時間允許,我們一直在爲手冊添加java配置。

有關使用文件出站通道適配器的示例,請參閱the file section

對於SFTP,該MessageHandlerFileTransferringMessageHandler - 它需要與會話出廠時配置等

0

此設置爲我

<si-sftp:outbound-channel-adapter 
    channel="toFtp" id="FtpAdapter" 
    session-factory="FtpSessionFactory" 
    cache-sessions="false" 
    remote-directory="${rftp.remotedir}" 
    remote-filename-generator="FileNameGenerator" 
    /> 

<bean id="sFtpSessionFactory"  
    class="util.ftp.DefaultFtpSessionFactory"> 
    <property name="host" value="${ftp.host}" /> 
    <property name="password" value="${ftp.password}"/> 
    <property name="port" value="${ftp.port}" /> 
    <property name="username" value="${ftp.user}" /> 
    <property name="connectTimeout" value="${ftp.connect.timeout.millis}"/> 
    <property name="defaultTimeout" value="${ftp.default.timeout.millis}"/> 
    <property name="dataTimeout" value="${ftp.data.timeout.millis}"/> 
    <property name="clientMode" value="${common.ftp.client.mode}"/> 
</bean> 
工作