java 所有者属性文件位置

vhmi4jdf  于 2023-04-10  发布在  Java
关注(0)|答案(2)|浏览(92)

我把config.properties文件放在intellij IDE的src/test/resources/config.properties中。
当我初始化这段代码时

@Config.Sources({"classpath:config.properties"})
public interface PropertiesManager extends Config {

找不到该文件,但该文件位于target/test-classes/config.properties。它就是找不到该文件。
如何正确申报。谢谢。请帮忙。

h43kikqp

h43kikqp1#

@Config.Sources({“classpath:target/test-classes/config.properties“})
打印出来的时候还是返回null,有什么问题吗?

cbeh67ev

cbeh67ev2#

我有相同的场景运行正常。所以你应该解决你的构建工具,如maven或gradle:为什么你的测试没有得到测试资源。

相关问题