19 lines
500 B
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);
|
|
}
|
|
}
|
|
}
|