Java 如何在spring集成中获得文件的完整路径?
我不熟悉Spring集成。我有下面的代码。我已在系统中的一个文件夹中放置了一个文本文件,并已将入站通道适配器配置如下:Java 如何在spring集成中获得文件的完整路径?,java,spring,spring-integration,Java,Spring,Spring Integration,我不熟悉Spring集成。我有下面的代码。我已在系统中的一个文件夹中放置了一个文本文件,并已将入站通道适配器配置如下: <int-file:inbound-channel-adapter channel="filesInChannel" directory="file:${java.io.tmpdir}/input" auto-create-directory="true" > <int:poller id="poller" fixed-delay="100
<int-file:inbound-channel-adapter channel="filesInChannel"
directory="file:${java.io.tmpdir}/input" auto-create-directory="true" >
<int:poller id="poller" fixed-delay="1000" />
</int-file:inbound-channel-adapter>
<int:channel id="filesInChannel"> </int:channel>
我的问题来自频道(filesInChannel
),我如何知道文件名及其绝对路径
例如:我的文件位于C:\someFolder\some.txt
从通道我应该到上面的路径 一旦你有了文件名,你想做什么 消息负载是一个
java.io.File
,因此您可以简单地使用表达式payload.absolutePath
,例如:
<header-enricher...>
<header name="foo" expression="payload.absolutePath" />
</header-enricher>
查看API中的