读取properties配置文件
2018-02-23 本文已影响0人
暖栀_5adc
public static StringgetDirPath() {
Resource resource =null;
Properties props =null;
String driverClass =null;
try {
resource =new ClassPathResource("/application.properties");
props = PropertiesLoaderUtils.loadProperties(resource);
driverClass = (String) props.get("socketPort");
}catch (IOException e) {
e.printStackTrace();
}
return driverClass;
}