Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

How do you get the active Springframework profiles?
Inject the Environment object

    private Environment environment;

The Environment object has getActiveProfiles that returns an array of active profiles. To get the first active profile, do…

String profile = environment.getActiveProfiles()[0];

February 11th, 2014

Posted In: Spring, Spring Profile

Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

WP to LinkedIn Auto Publish Powered By :