读取并解析properties文件

public class SysConfig {

    private static final Properties properties = new Properties();
    static{
       Resource rs1 = new ClassPathResource("sys-config.properties");

        try {
            properties.load(rs1.getInputStream());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String get(String key){
        return properties.getProperty(key);
    }

    public static void main(String args[]){
        SysConfig.get("emialUrl");
    }

}

 

posted @ 2015-08-19 18:24  耗子搞IT  阅读(232)  评论(0编辑  收藏  举报