getResourceAsStream在Thread.currentThread.getContextClassLoad



所以库当前使用的加载配置是

ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream in = loader.getClass().getResourceAsStream("/properties/a.properties") // null

但是当我尝试调试应用程序时,下面的表达式包含文件

loader.getResourceAsStream("properties/a.properties")

我使用的是IntelliJ IDE和Maven构建工具。资源被复制到目标文件夹中。并使用IntelliJ run命令当前运行该类。

由于代码来自库,我无法修改它。这里的问题是什么,如何解决?

一个可能的解决方法是将Java版本降级为非模块版本(小于9(,以便代码正常工作。

相关内容

  • 没有找到相关文章

最新更新