java 加载properties属性

 public static Properties getPropertiesByName(String propertiesName) {

  Properties pro=new Properties();
  try {
   InputStream inStream =ProcDef.class.getClassLoader().getResourceAsStream(propertiesName);
   pro.load(inStream);
   inStream.close();
  } catch (FileNotFoundException e) {
      log.error("FileNotFoundException   初始化属性",e);
  } catch (IOException e) {
      log.error("IOException 初始化属性",e);
  }
  return pro;
     } 

你可能感兴趣的:(java,properties)