1、
ResourceBundle rb = ResourceBundle.getBundle("config");
String entModal = rb.getString("entModal");
2、
String configPath = "../../../../../config.properties";
UFileConfig.getInstance().loadConfig(configPath);
public void loadConfig(String configPath) {
InputStream inputStream = null;
try {
inputStream = new FileInputStream(configPath);
Properties configProperties = new Properties();
configProperties.load(inputStream);
this.a = configProperties.getProperty("A");
this.entModal= configProperties.getProperty("entModal");
} catch (Exception e) {
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}