如何在 spring 集成 XML 配置中使用相对路径
How to use relative path in spring integration in XML config
我想使用相对于我的项目路径的 directory
属性
<file:inbound-channel-adapter directory="{?relativePathHere?}" channel="In" >
<int:poller id="poller" fixed-delay="5000" />
</file:inbound-channel-adapter>
我是 SI 的新手,谁能提供如何将相对(非绝对)路径用于属性的方式?
相对于什么?
默认情况下,它是相对于当前工作目录的...
directory="foo/bar"
将解析为 System.getProperty("user.dir") + "/foo/bar"
directory="/foo/bar"
是绝对的:“/foo/bar”`
directory="classpath:foo/bar"
将解析为 foo/bar
类路径中的某处。
编辑:
要引用用户主页中的目录,您可以使用 Spring 表达式语言 (SpEL) 来获取 属性:
directory="#{systemProperties['user.home']}/foo/bar">
我想使用相对于我的项目路径的 directory
属性
<file:inbound-channel-adapter directory="{?relativePathHere?}" channel="In" >
<int:poller id="poller" fixed-delay="5000" />
</file:inbound-channel-adapter>
我是 SI 的新手,谁能提供如何将相对(非绝对)路径用于属性的方式?
相对于什么?
默认情况下,它是相对于当前工作目录的...
directory="foo/bar"
将解析为 System.getProperty("user.dir") + "/foo/bar"
directory="/foo/bar"
是绝对的:“/foo/bar”`
directory="classpath:foo/bar"
将解析为 foo/bar
类路径中的某处。
编辑:
要引用用户主页中的目录,您可以使用 Spring 表达式语言 (SpEL) 来获取 属性:
directory="#{systemProperties['user.home']}/foo/bar">