欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PropertiesUtil

程序员文章站 2022-04-25 14:29:31
...

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

推荐阅读