2

我想将我的 xml 配置转换为 Java 类配置,但我找不到解决方案。例如我的一段配置:

<file:inbound-channel-adapter id="filesIn" directory="file:${java.io.tmpdir}/spring-integration-samples/input"
                              filename-regex="^.*\.(xml|json)$" >
    <int:poller id="poller" fixed-delay="5000"/>
</file:inbound-channel-adapter>


<int:service-activator input-channel="filesIn"
                       output-channel="filesOut"
                       ref="handler"/>

<file:outbound-channel-adapter id="filesOut" directory="file:${java.io.tmpdir}/spring-integration-samples/output"
                               delete-source-files="true"/>



<file:inbound-channel-adapter id="filesContent" directory="file:${java.io.tmpdir}/spring-integration-samples/output"
                              filename-regex="^.*\.(xml|json)$" prevent-duplicates="true">
    <int:poller id="poller2" fixed-delay="5000"/>
 </file:inbound-channel-adapter>

我怎样才能做同样的事情,但在我的本地机器上使用 sftp(src 目录)以及如何在 java 类中编写这个配置。给我任何建议,我正在寻找答案,但我找不到出路。

4

1 回答 1

2

首先,您应该从Spring Integration Java DSL Reference Manual开始。在那里,您将找到 Java DSL 的一般概念以及它与 XML 配置的关系。

您可以在相应的参考手册章节中找到 SFTP 入站/出站通道适配器配置示例。例如,<int:service-activator>在 Java DSL 中可能看起来像:

.handle(handler)

如果您在单个IntegrationFLow.

于 2017-07-17T14:48:22.277 回答