优化配置读取

This commit is contained in:
none
2023-02-15 17:18:58 +08:00
parent 2813e98d9e
commit 0e51cd7ceb
4 changed files with 28 additions and 45 deletions

View File

@@ -1,37 +0,0 @@
package xyz.playedu.api.util;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
/**
* 系统文件配置操作工具
*/
@Component
public class EnvUtil implements EnvironmentAware {
private static Environment env;
/**
* 设置环境变量
*
* @author fzr
* @param environment 环境变量
*/
@Override
public void setEnvironment(Environment environment) {
EnvUtil.env = environment;
}
/**
* 根据Key获取值
*
* @author fzr
* @param key 键
* @return String
*/
public static String get(String key) {
return env.getProperty(key);
}
}