在resources/META-INF下创建文件夹,然后将文件置于文件夹内。 第一次获取成功,其余为null。暂不明原 因。
String sourcePath = this.getClass().getClassLoader().getResource("file.txt").getPath();
后将文件置于/META-INF下同层下,此情况没再发生。运行环境为springBoot,多模块开发。
在resources/META-INF下创建文件夹,然后将文件置于文件夹内。 第一次获取成功,其余为null。暂不明原 因。
String sourcePath = this.getClass().getClassLoader().getResource("file.txt").getPath();
后将文件置于/META-INF下同层下,此情况没再发生。运行环境为springBoot,多模块开发。