[BAEL-14274] - Fixed article code for https://www.baeldung.com/spring-profiles

This commit is contained in:
amit2103 2019-06-23 23:06:32 +05:30
parent 9d7d7b4dde
commit b1ff8e6289
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package org.baeldung.startup;
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);
}
}
}