获取 .properties 配置文件中的值

来源:互联网 发布:数据审核制度 编辑:程序博客网 时间:2024/04/29 19:26
public static String getPath() {
  String path = "";
  Properties prop = new Properties();
        try {
         InputStream in = ImageURL.class.getClassLoader().getResourceAsStream("jdbc.properties");
            prop.load(in);
            
            path = prop.getProperty("admin.path");
            
            in.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return path;
 }
原创粉丝点击