【发布时间】:2018-09-21 19:11:19
【问题描述】:
我使用的是 Spring Framework 版本 Windows 7 上 Intellij 下的 4.3.18.RELEASE。 我正在查看例如类的反编译代码
org.springframework.core.io.DefaultResourceLoader
以及方法
public Resource getResource(String location).
在该代码中,它有一个测试
location.startsWith("/")
当位置是 带有前导驱动器号的绝对 Windows 路径。例如
d:/git/thredds/dap4/d4tests/src/test/resources/
这种路径是否存在已知的替代规范?
【问题讨论】:
-
你尝试过类似 getResource("file:d:\\git\thredds\blah.txt")
-
这似乎可行,谢谢。
-
对于以这种方式定义的资源文件:
file:///data/resources/file.txtwindows 中使用以下路径:c:\data\resources\file.txt
标签: java spring windows path drive-letter