配置文件中的 local-dir 别名

local-dir alias in configuration file

我在哪里可以找到说明 "file:local-dir" 是 xml 配置文件中的别名的文档?

此表示法例如用于 int-sftp:inbound-channel-adapter 示例文件。

我猜你指的是 https://github.com/spring-projects/spring-integration-samples/blob/master/basic/sftp/src/test/resources/META-INF/spring/integration/SftpInboundReceiveSample-context.xml#L29 中的这个 local-directory="file:local-dir"

所以,file:前缀表示一个org.springframework.core.io.Resource类型,可以在应用上下文中从Stringlocation解析为真正的Resource对象以 ResourceLoader 启动。是的,在我们的例子中它将是 AbstractInboundFileSynchronizingMessageSource.setLocalDirectory(File localDirectory)。无论如何,将 Resourcelocation 转换为 File 对象是一个 Spring ConversionService 魔法。

有关受支持的有效资源后缀的详细信息,请参阅 org.springframework.util.ResourceUtils