private PropertySource < ? > loadSettingsByApplicationProfiles ( final Environment environment , final File config ) { val profiles = ConfigurationPropertiesLoaderFactory . getApplicationProfiles ( environment ) ; val resources = scanForConfigurationResources ( config , profiles ) ; val composite = new CompositePropertySource ( "applicationProfilesCompositeProperties" ) ; LOGGER . info ( "Configuration files found at [{}] are [{}] under profile(s) [{}]" , config , resources , profiles ) ; resources . forEach ( Unchecked . consumer ( f -> { LOGGER . debug ( "Loading configuration file [{}]" , f ) ; val loader = configurationPropertiesLoaderFactory . getLoader ( f , "applicationProfilesProperties-" + f . getFilename ( ) ) ; composite . addFirstPropertySource ( loader . load ( ) ) ; } ) ) ; return composite ; }
Property files processed in order of non - profiles first and then profiles and profiles are first to last with properties in the last profile overriding properties in previous profiles or non - profiles .