增加静态方法
This commit is contained in:
parent
5c590b3f52
commit
70c329a5cc
@ -3,6 +3,7 @@ package ink.wgink.common.manager.env;
|
||||
import ink.wgink.common.dao.env.IEnvDao;
|
||||
import ink.wgink.common.pojo.Env;
|
||||
import ink.wgink.common.pojo.dtos.env.EnvDTO;
|
||||
import ink.wgink.exceptions.base.SystemException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -26,7 +27,8 @@ public class EnvManager {
|
||||
private IEnvDao envDao;
|
||||
private Env env = new Env();
|
||||
|
||||
private EnvManager() {}
|
||||
private EnvManager() {
|
||||
}
|
||||
|
||||
public static EnvManager getInstance() {
|
||||
return envManager;
|
||||
@ -72,6 +74,14 @@ public class EnvManager {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String value(String key) {
|
||||
String value = getInstance().getValue(key);
|
||||
if (StringUtils.isBlank(value)) {
|
||||
throw new SystemException("未配置" + key + "变量");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setEnvDao(IEnvDao envDao) {
|
||||
this.envDao = envDao;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user