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);

prop.load(in);

} catch (IOException e) {

e.printStackTrace();

}

}

 

public static String getProperty(String key){

return prop.getProperty(key);

}

 

}

你可能感兴趣的:(properties)