读取文件(Properties.xml)中数据
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropUtil {
static Properties prop = new Properties();
static {
InputStream in=ResourceReader.getResourceAsStream("config/config.properties");
try {
prop.load(in);
} catch (IOException e) {
e.printStackTrace();
}finally{
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static String get(String key){
return prop.getProperty(key);
}
}