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();
    }
原文地址:https://www.cnblogs.com/qgli/p/3539477.html