【发布时间】:2018-11-02 15:58:06
【问题描述】:
我在资源文件夹src/test/resources/file.xml 下有一个文件
另一个在src/test/resources/test.properties 下。我想在属性文件中设置一个属性指向file.xml。我怎样才能做到这一点?
假设我有财产
test.file = file.xml
我的java类读取文件如下:
File cert = new File(fileName); // fileName is the value of test.file
但这不起作用。
【问题讨论】:
-
不太清楚问题是什么。你遇到了什么错误?
-
您需要完整路径或
URI实例来创建File的实例。 -
@question_tech 您需要使用相对路径来获取全名。请检查我的答案
标签: java spring-mvc properties-file