private CompositePropertySource loadSettingsByApplicationProfiles(final Environment environment, final File config) {
        val profiles = Arrays.stream(environment.getActiveProfiles()).toList();
        val resources = scanForConfigurationResources(environment, config, profiles);
        val composite = new CompositePropertySource("applicationProfilesCompositeProperties");
        LOGGER.info("Configuration files found at [{}] are [{}] under profile(s) [{}]", config, resources, profiles);
        resources.forEach(Unchecked.consumer(resource -> {
            LOGGER.debug("Loading configuration file [{}]", resource);

            val configurationLoaders = CasConfigurationPropertiesSourceLocator.getConfigurationPropertiesLoaders();
            val foundLoader = configurationLoaders
                .stream()
                .filter(loader -> loader.supports(resource))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("No configuration loader is found to support " + resource));

            val source = foundLoader.load(resource, environment,
                "applicationProfilesProperties-" + resource.getFilename(), casConfigurationCipherExecutor);
            composite.addFirstPropertySource(source);


        }));
        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.

@param environment Spring environment
@param config      Location of config files
@return Merged properties
core/cas-server-core-configuration-api/src/main/java/org/apereo/cas/configuration/DefaultCasConfigurationPropertiesSourceLocator.java