com.ruoyi.common.utils.YamlUtil Java Examples

The following examples show how to use com.ruoyi.common.utils.YamlUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Global.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 获取配置
 */
public static String getConfig(String key)
{
    String value = map.get(key);
    if (value == null)
    {
        Map<?, ?> yamlMap = null;
        try
        {
            yamlMap = YamlUtil.loadYaml(NAME);
            value = String.valueOf(YamlUtil.getProperty(yamlMap, key));
            map.put(key, value != null ? value : StringUtils.EMPTY);
        }
        catch (FileNotFoundException e)
        {
            log.error("获取全局配置异常 {}", key);
        }
    }
    return value;
}
 
Example #2
Source File: Global.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 获取配置
 */
public static String getConfig(String key)
{
    String value = map.get(key);
    if (value == null)
    {
        Map<?, ?> yamlMap = null;
        try
        {
            yamlMap = YamlUtil.loadYaml(NAME);
            value = String.valueOf(YamlUtil.getProperty(yamlMap, key));
            map.put(key, value != null ? value : StringUtils.EMPTY);
        }
        catch (FileNotFoundException e)
        {
            log.error("获取全局配置异常 {}", key);
        }
    }
    return value;
}
 
Example #3
Source File: Global.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取配置
 */
private static String getConfig(String key) {
    String value = map.get(key);
    if (value == null) {
        Map<?, ?> yamlMap;
        try {
            yamlMap = YamlUtil.loadYaml(NAME);
            value = String.valueOf(YamlUtil.getProperty(yamlMap, key));
            map.put(key, value != null ? value : StrUtil.EMPTY);
        } catch (Exception e) {
            log.error("获取全局配置异常 {}" , key);
        }
    }
    return value;
}