Browse Source

代码微调

dev_shibei_match
jianjun 5 years ago
parent
commit
2ee24b2f39
  1. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java

15
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java

@ -11,11 +11,14 @@ import org.springframework.core.env.Environment;
* @date 2020-07-03 11:14
**/
public enum EnvEnum {
LOCAL("local", "本地环境","http://localhost:8080/api/"),
DEV("dev", "开发环境","http://192.168.1.130:8080/api/"),
TEST("test", "体验环境","https://epmet-dev.elinkservice.cn/api/"),
PROD("prod", "生产环境","https://epmet-cloud.elinkservice.cn/api/"),
UN_KNOWN("un_known", "未知","https://epmet-dev.elinkservice.cn/api/"),
/**
* 环境变量枚举
*/
LOCAL("local", "本地环境", "http://localhost:8080/api/"),
DEV("dev", "开发环境", "http://192.168.1.130:8080/api/"),
TEST("test", "体验环境", "https://epmet-dev.elinkservice.cn/api/"),
PROD("prod", "生产环境", "https://epmet-cloud.elinkservice.cn/api/"),
UN_KNOWN("un_known", "未知", "https://epmet-dev.elinkservice.cn/api/"),
;
private String code;
@ -44,7 +47,7 @@ public enum EnvEnum {
try {
Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles != null && activeProfiles.length > 0) {
if (activeProfiles.length > 0) {
return getEnum(activeProfiles[0]);
}
} catch (Exception e) {

Loading…
Cancel
Save