Java项目中使用配置文件配置

private String readConfig() {
        Properties p = new Properties();
        InputStream in = getClass().getClassLoader().getResourceAsStream(
                "此处为配置文件的文件名");
        try {
            p.load(in);
            String[] url = p.getProperty("server.url").split(";");//在配置文件中的配置信息         
        } catch (IOException e) {
            e.printStackTrace();
        }
        return p.toString();
    }

 

posted @ 2014-02-07 14:24  QG_Li  阅读(583)  评论(0编辑  收藏  举报