-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProfileUtil.java
More file actions
32 lines (25 loc) · 972 Bytes
/
ProfileUtil.java
File metadata and controls
32 lines (25 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package life.mosu.mosuserver.global.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class ProfileUtil implements ApplicationContextAware {
private static Environment environment;
public static String[] getActiveProfilesStatic() {
return environment.getActiveProfiles();
}
public static boolean isProfileActiveStatic(String profile) {
for (String active : environment.getActiveProfiles()) {
if (active.equals(profile)) {
return true;
}
}
return false;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
environment = applicationContext.getEnvironment();
}
}