fg电池监控平台的达梦数据库版本
whycxzp
2024-11-11 0f5f5e435cbc4c60ffad2bb84cfe8cc57ea32ddc
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.whyc.properties;
 
import lombok.extern.log4j.Log4j2;
import org.springframework.util.StringUtils;
 
import java.io.IOException;
import java.io.InputStream;
 
/**
 * @Description 读取Properties的工具类
 */
@Log4j2
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";
        }*/
        InputStream is=null;
        try {
            is=PropertiesUtil.class.getClassLoader()
                    .getResourceAsStream("config/authentication.properties");
            propertiesShiro.load(is);
        } catch (Exception e) {
            log.warn("资源路径中不存在authentication.properties权限文件,忽略读取!");
        }finally {
            if(is!=null){
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
    /**
     * 根据key得到value的值
     */
    public static String getShiroValue(String key) {
        return propertiesShiro.getProperty(key);
    }
 
}