protected PropertySource<?> loadEmbeddedProperties(final ResourceLoader resourceLoader,
                                                       final Environment environment) {
        val profiles = Arrays.stream(environment.getActiveProfiles()).toList();
        val configFiles = profiles
            .stream()
            .map(profile -> EXTENSIONS.stream()
                .map(ext -> String.format("classpath:/application-%s.%s", profile, ext))
                .collect(Collectors.toList()))
            .flatMap(List::stream)
            .map(resourceLoader::getResource)
            .collect(Collectors.toList());

        configFiles.addAll(EXTENSIONS.stream()
            .map(ext -> String.format("classpath:/application.%s", ext))
            .map(resourceLoader::getResource).toList());

        LOGGER.debug("Loading embedded configuration files [{}]", configFiles);

        val composite = new CompositePropertySource("embeddedCompositeProperties");
        val configurationLoaders = CasConfigurationPropertiesSourceLocator.getConfigurationPropertiesLoaders();

        configFiles
            .stream()
            .filter(Resource::exists)
            .forEach(resource -> {
                LOGGER.trace("Loading properties from [{}]", resource);
                val foundLoader = configurationLoaders
                    .stream()
                    .filter(loader -> loader.supports(resource))
                    .findFirst()
                    .orElseThrow(() -> new IllegalArgumentException("No configuration loader is found to support " + resource));
                val sourceName = String.format("embeddedProperties-%s", resource.getFilename());
                val source = foundLoader.load(resource, environment, sourceName, casConfigurationCipherExecutor);
                composite.addPropertySource(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