Created
March 17, 2016 23:39
-
-
Save norbertpotocki/289f3943249ea2813dcf to your computer and use it in GitHub Desktop.
Merge configuration using MergeConfigurationSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
ConfigurationProvider configurationProvider(ConfigurationSource configurationSource, | |
@Value("${configuration.environment}") String configurationEnvironment) { | |
ConfigurationSource localOverrideSource = new FilesConfigurationSource(() -> Collections.singletonList(Paths.get("application.properties"))); | |
MergeConfigurationSource mergeConfigurationSource = new MergeConfigurationSource(localOverrideSource, configurationSource); | |
return new ConfigurationProviderBuilder() | |
.withConfigurationSource(mergeConfigurationSource) | |
.withEnvironment(new ImmutableEnvironment("app/" + configurationEnvironment + "/feature")) | |
.withReloadStrategy(new PeriodicalReloadStrategy(30, TimeUnit.SECONDS)) | |
.build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment