public static Profile getCurrentProfile ( ) { // First get profile from system properties Profile profile = getProfileFromSystemProperties ( ) ; // check if profile has been found otherwise try getting profile from file in classpath if ( profile == null ) { profile = getProfileFromFileInClasspath ( ProfilePropertyNames . PROFILE_SET_BY_FILE_IN_CLASSPATH_FILENAME ) ; } // use DEFAULT profile, if profile has not been found if ( profile == null ) { profile = ProfilePropertyNames . DEFAULT_PROFILE ; } return profile ; }
Gets the current profile . Uses the following algorithm to determine the profile . 1 . If System Property is set force it as profile 2 . If Custom Profile resource can be located in classpath use that file as profile 3 . Use default profile