lxw
2023-11-22 cba96d4cbd3ddd8af20b2d65d1f430c75f667821
src/main/java/com/whyc/properties/PropertiesUtil.java
@@ -3,6 +3,9 @@
import lombok.extern.log4j.Log4j2;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.InputStream;
/**
 * @Description 读取Properties的工具类
 */
@@ -21,11 +24,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();
                }
            }
        }
    }