Kon*_*ner 1 java resources properties
我不喜欢让我的属性文件进入resources/mypackage/.../somepackage/resourcefile.properties,而宁愿让它们进入resources/resourcefile.properties.在没有的情况下,这是否可行:
MyApplication.class.getResourceAsStream("../../../../../../../../resources/resourcefile.properties")或SomeClass.getClassLoader().getResourceAsStream("resourcefile.properties")?添加一个前导斜杠来指定根包:
SomeClass.getClassLoader().getResourceAsStream("/resourcefile.properties")
Run Code Online (Sandbox Code Playgroud)