获取 .properties 配置文件中的值

来源:互联网 发布:arttemplate.js官网 编辑:程序博客网 时间:2024/05/16 01:07

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;
 }

原创粉丝点击