Files
spring-boot-rest/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/profiles/ProfileManager.java

19 lines
500 B
Java

package com.baeldung.profiles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class ProfileManager {
@Autowired
private Environment environment;
public void getActiveProfiles() {
for (final String profileName : environment.getActiveProfiles()) {
System.out.println("Currently active profile - " + profileName);
}
}
}