whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/properties/PropertiesUtil.java
@@ -1,12 +1,14 @@
package com.whyc.properties;
import lombok.extern.log4j.Log4j2;
import org.springframework.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.io.InputStream;
/**
 * @Description 读取Properties的工具类
 */
@Log4j2
@Slf4j
public class PropertiesUtil {
    public static LinkProperties propertiesShiro = new LinkProperties();
@@ -21,11 +23,21 @@
        } else {
            sysName += ".properties";
        }*/
        InputStream is=null;
        try {
            propertiesShiro.load(PropertiesUtil.class.getClassLoader()
                    .getResourceAsStream("config/authentication.properties"));
            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();
                }
            }
        }
    }