/** * Adding items to composite property source which contains property sources processed in order, first one wins. * First Priority: Standalone configuration file * Second Priority: Configuration files in config dir, profiles override non-profiles, last profile overrides first * Third Priority: classpath:/application.yml * * @param environment the environment * @param resourceLoader the resource loader * @return CompositePropertySource containing sources listed above */ @Override public PropertySource<?> locate(final Environment environment, final ResourceLoader resourceLoader) { val compositePropertySource = new CompositePropertySource("casCompositePropertySource"); val configFile = casConfigurationPropertiesEnvironmentManager.getStandaloneProfileConfigurationFile(); if (configFile != null) { val sourceStandalone = loadSettingsFromStandaloneConfigFile(environment, configFile); compositePropertySource.addPropertySource(sourceStandalone); } val config = casConfigurationPropertiesEnvironmentManager.getStandaloneProfileConfigurationDirectory(); LOGGER.debug("Located CAS standalone configuration directory at [{}]", config); if (config != null && config.isDirectory() && config.exists()) { val sourceProfiles = loadSettingsByApplicationProfiles(environment, config); compositePropertySource.addPropertySource(sourceProfiles); } else { LOGGER.info("Configuration directory [{}] is not a directory or cannot be found at the specific path", config); } val sourceYaml = loadEmbeddedYamlOverriddenProperties(resourceLoader); compositePropertySource.addPropertySource(sourceYaml); return compositePropertySource; }