PropertiesUtils(普遍做法)

public class PropertiesUtil{

  private static Properties properties;

  static{

    InputStream in = null;

    try{

      in = PropertiesUtil.class.getClassLoader().getResourceAsStream("jdbc.properties");

      properties = new Properties();

      properties.load(in);

    }catch(Exception e){

      e.printStackTrace();

    }finally{

      try{

        if(in != null){

          in.close();

        }

      }catch(Exception e){

        e.printStackTrace();

    }

  }

  }

   public static Properties getPropertis(){

    return properties;  

  }

  

}

posted @ 2018-11-01 08:32  梦浍烈风灵  阅读(1069)  评论(0编辑  收藏  举报