Issue
I need to code different logic based on different current Environment profile.
How can you get the currently active and default profiles from Spring?
Solution
You can autowire the Environment
@Autowired
Environment env;
Environment
offers:
String[] getActiveProfiles()
,String[] getDefaultProfiles()
, andboolean acceptsProfiles(String... profiles)
Answered By - aweigold
Answer Checked By - David Goodson (JavaFixing Volunteer)