关于读取properties文件路径问题

 1 1.方法一 
 2 InputStream fis =TestProperties.class.getClassLoader().getResourceAsStream(“init.properties”)
 3 
 4 2.方法二(要求TestProperties和init.properties在同一目录下) 
 5 InputStream fis =TestProperties.class.getResourceAsStream(“init.properties”)
 6 
 7 3.方法三,对于Web工程也可以这样。 
 8 先获取ServletContext,然后 
 9 
10 InputStream in=context.getResourceAsStream(“/WEB-INF/classes/init.properties”);
原文地址:https://www.cnblogs.com/stay-hungry/p/9480475.html