One-Stop Guide to Profiles with Spring Boot
Go to Tomcat server folder
open the catalina.properties and add below entry
spring.profiles.active=localTestEnv
Programmatically read profile
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
@Autowired
private Environment environment;
String[] activeProfiles = environment.getActiveProfiles();
logger.info("active profiles: {}"+ Arrays.toString(activeProfiles));
logger.info("active profiles: {}"+ StringUtils.arrayToCommaDelimitedString(activeProfiles));
Comments
Post a Comment