Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Merge configuration using MergeConfigurationSource
@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
You can’t perform that action at this time.