获取properties属性

public static String getProperticesValue(String key,String configName) throws IOException{
        String path="/";
//        String path=getPath();
//        if(path!=null){
            path+=configName+".properties";
//            InputStream in = new BufferedInputStream(new FileInputStream(path));
            InputStream in = getInputStream(new GetResource(), path);
            Properties properties=new Properties();
            properties.load(in);
            String  value=properties.get(key)+"";
//            log.debug("---方法getProperticesValue通过绝对路径和key获取web项目"+configName+".propertices的value值:"+value);
            return value;
//        }else{
//            return null;
//        }
    }

 

posted @ 2018-03-29 15:34  lhm_java  阅读(149)  评论(0编辑  收藏  举报