@Test public void includeValueCanContainPlaceholder() { createStubConfig("/test/base-config.yml", ImmutableMap.of( "include", "${include-placeholder}", "number", 123, "string", "abc", "numberFromParent", 999, "hasPlaceholder", "${string}" )); createStubConfig("/test/parent-config.yml", ImmutableMap.of( "numberFromParent", 111, "stringFromParent", "DEF")); ConfigurationParser<StubConfiguration> parser = new ConfigurationParser.Builder<StubConfiguration>() .format(format) .overrides(ImmutableMap.of("include-placeholder", "/test/parent-config.yml")) .build(); StubConfiguration parsedConfiguration = parser.parse(configSource(newResource("/test/base-config.yml"))); assertThat(parsedConfiguration.get("stringFromParent"), isValue("DEF")); }
public C parse(ConfigurationSource provider) { LOGGER.debug("Parsing configuration in format={} from source={}", format, provider); C configuration = doParse(provider).withOverrides(overrides); PlaceholderResolutionResult<C> resolved = configuration.resolvePlaceholders(overrides); if (!resolved.unresolvedPlaceholders().isEmpty()) { throw new IllegalStateException(format("Unresolved placeholders: %s", resolved.unresolvedPlaceholders())); } return resolved.resolvedConfiguration(); }
ConfigurationParser { public C parse(ConfigurationSource provider) { LOGGER.debug("Parsing configuration in format={} from source={}", format, provider); C configuration = doParse(provider).withOverrides(overrides); PlaceholderResolutionResult<C> resolved = configuration.resolvePlaceholders(overrides); if (!resolved.unresolvedPlaceholders().isEmpty()) { throw new IllegalStateException(format("Unresolved placeholders: %s", resolved.unresolvedPlaceholders())); } return resolved.resolvedConfiguration(); } }
ConfigurationParser { public C parse(ConfigurationSource provider) { LOGGER.debug("Parsing configuration in format={} from source={}", format, provider); C configuration = doParse(provider).withOverrides(overrides); PlaceholderResolutionResult<C> resolved = configuration.resolvePlaceholders(overrides); if (!resolved.unresolvedPlaceholders().isEmpty()) { throw new IllegalStateException(format("Unresolved placeholders: %s", resolved.unresolvedPlaceholders())); } return resolved.resolvedConfiguration(); } private  ConfigurationParser(Builder<C> builder); }
ConfigurationParser { public C parse(ConfigurationSource provider) { LOGGER.debug("Parsing configuration in format={} from source={}", format, provider); C configuration = doParse(provider).withOverrides(overrides); PlaceholderResolutionResult<C> resolved = configuration.resolvePlaceholders(overrides); if (!resolved.unresolvedPlaceholders().isEmpty()) { throw new IllegalStateException(format("Unresolved placeholders: %s", resolved.unresolvedPlaceholders())); } return resolved.resolvedConfiguration(); } private  ConfigurationParser(Builder<C> builder); C parse(ConfigurationSource provider); }
ConfigurationParser { public C parse(ConfigurationSource provider) { LOGGER.debug("Parsing configuration in format={} from source={}", format, provider); C configuration = doParse(provider).withOverrides(overrides); PlaceholderResolutionResult<C> resolved = configuration.resolvePlaceholders(overrides); if (!resolved.unresolvedPlaceholders().isEmpty()) { throw new IllegalStateException(format("Unresolved placeholders: %s", resolved.unresolvedPlaceholders())); } return resolved.resolvedConfiguration(); } private  ConfigurationParser(Builder<C> builder); C parse(ConfigurationSource provider);  }