您的位置:首页 > 编程语言 > Java开发

java读取配置文件写法

2016-10-03 15:20 316 查看
package com.lile.util;

import java.io.InputStream;

import java.util.Properties;

public class PropertiesUtil {

    

    public static String getValue(String key){

        

        Properties properties = new Properties();

        InputStream is = new PropertiesUtil().getClass().getResourceAsStream("/diary.properties");

        

        try{

            properties.load(is);

        }catch(Exception e){

            

        }

        return (String)properties.get(key);

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: