whycxzp
2025-01-13 6f1a421696df24fcfcdcbd45e0cb8b15c79b47f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.whyc.properties;
 
import lombok.extern.slf4j.Slf4j;
 
/**
 * @Description 读取Properties的工具类
 */
@Slf4j
public class PropertiesUtil {
 
    public static LinkProperties propertiesShiro = new LinkProperties();
 
    /**
     * 读取properties配置文件信息
     */
    static {
        /*String sysName = System.getProperty("sys.name");
        if (StringUtils.isEmpty(sysName)) {
            sysName = "application.properties";
        } else {
            sysName += ".properties";
        }*/
        try {
            propertiesShiro.load(PropertiesUtil.class.getClassLoader()
                    .getResourceAsStream("config/authentication.properties"));
        } catch (Exception e) {
            log.warn("资源路径中不存在authentication.properties权限文件,忽略读取!");
        }
    }
 
    /**
     * 根据key得到value的值
     */
    public static String getShiroValue(String key) {
        return propertiesShiro.getProperty(key);
    }
 
}