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

 获取配置文件 随笔

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

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");

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄