How to set Spring profile from system variable?
SPRING_PROFILES_ACTIVE is the environment variable to override/pick Spring profile
SPRING_PROFILES_ACTIVE is the environment variable to override/pick Spring profile
You can autowire the Environment @Autowired Environment env; Environment offers: String[] getActiveProfiles(), String[] getDefaultProfiles(), and boolean acceptsProfiles(String… profiles)