获取配置文件

实例:获取redis配置文件信息

public static final String KEY_PREFIX = Global.getConfig("redis.keyPrefix");
    /**
     * 获取配置
     * @see ${fns:getConfig('adminPath')}
     */
    public static String getConfig(String key) {
        String value = map.get(key);
        if (value == null){
            value = loader.getProperty(key);
            map.put(key, value != null ? value : StringUtils.EMPTY);
        }
        return value;
    }
    /**
     * 属性文件加载对象(spring)
     */
    private static PropertiesLoader loader = new PropertiesLoader("jeesite.properties");

猜你喜欢

转载自www.cnblogs.com/banxian-yi/p/10772299.html
今日推荐