欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

java读取配置文件,java配置文件,/** * 读取

来源: javaer 分享于  点击 21860 次 点评:111

java读取配置文件,java配置文件,/** * 读取


/**     * 读取配置文件     * @param file     * @return     */    public static PropertiesConfiguration loadConfig(String file){        PropertiesConfiguration config = null;        try {            config = new PropertiesConfiguration(file);            config.setEncoding("UTF-8");            config.setReloadingStrategy(new FileChangedReloadingStrategy());            config.setAutoSave(true);            logger.info("加载配置文件成功...");        } catch (ConfigurationException e) {            logger.info("加载配置文件失败,异常信息:"+e.getLocalizedMessage());        }        return config;    }
public static Configuration config = loadConfig("config.properties");``````javaConfigUtils.config.getString("weixin.app_id")
相关栏目:

用户点评