import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static Properties load(String fileName) {
InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName);
Properties prop = new Properties();
try {
prop.load(in);
} catch (IOException e) {
e.printStackTrace();
} finally{
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return prop;
}
}
web项目读取properties文件工具类
最新推荐文章于 2021-01-28 20:43:16 发布