import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static Properties loadProperties(String propertyFile){
Properties properties = new Properties();
try {
InputStream is = PropertiesUtil.class.getClassLoader().getResourceAsStream(propertyFile);
if(is == null){
is = PropertiesUtil.class.getClassLoader().getResourceAsStream(propertyFile);
}
properties.load(is);
} catch (IOException e) {
e.printStackTrace();
}
return properties;
}
public static String getValue(String propertyFile, String key) {
Properties properties = loadProperties(propertyFile);
return properties.getProperty(key);
}
public static void main(String[] args) {
Properties properties = PropertiesUtil.loadProperties("bdfw.properties");
sjzxUrl = properties.getProperty("SJZX_URL");
}
}