I need to code different logic based on different current Environment profile.
How can you get the currently active and default profiles from Spring?
You can autowire the Environment
Environment
@Autowired Environment env;
Environment offers:
String[] getActiveProfiles()
String[] getDefaultProfiles()
boolean acceptsProfiles(String... profiles)
1.4m articles
1.4m replys
5 comments
57.0k users