我不喜欢将我的属性文件放入resources/mypackage/.../somepackage/resourcefile.properties其中,而宁愿将它们放入resources/resourcefile.properties. 如果没有:
- 被迫写作
MyApplication.class.getResourceAsStream("../../../../../../../../resources/resourcefile.properties")或 - 使用时它在Tomcat中不起作用
SomeClass.getClassLoader().getResourceAsStream("resourcefile.properties")?