PropertiesUtil

import java.io.IOException;

import java.io.InputStream;

import java.util.Properties;

public class PropertiesUtil {

private static Properties prop = new Properties();

public static void readProperties(String filename){

try {

InputStream in =  PropertiesUtil.class.getClassLoader().getResourceAsStream(filename);

扫描二维码关注公众号,回复: 552910 查看本文章

prop.load(in);

} catch (IOException e) {

e.printStackTrace();

}

}

public static String getProperty(String key){

return prop.getProperty(key);

}

}

猜你喜欢

转载自cui313406075.iteye.com/blog/2338349