@Test public void childCanReplaceParentPlaceholders() { createStubConfig("/test/base-config.yml", ImmutableMap.of( "include", "/test/parent-config.yml", "childString", "abc" )); createStubConfig("/test/parent-config.yml", ImmutableMap.of( "parentString", "${childString}" )); ConfigurationParser<StubConfiguration> parser = new ConfigurationParser.Builder<StubConfiguration>() .format(format) .build(); StubConfiguration parsedConfiguration = parser.parse(configSource(newResource("/test/base-config.yml"))); assertThat(parsedConfiguration.get("parentString"), isValue("abc")); }
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);  }