@Test public void testPrecedence() { System.setProperty("com.ACME.size", "sys-prop-value"); Map<String, String> appValues = Map.of("app.key", "app-value", "com.ACME.size", "app-value", "server.executor-service.max-pool-size", "app-value"); ConfigSource appSource = ConfigSources.create(appValues).build(); Config appOnly = Config.builder(appSource) .disableEnvironmentVariablesSource() .disableSystemPropertiesSource() .build(); assertValue("app.key", "app-value", appOnly); assertValue("com.ACME.size", "app-value", appOnly); assertValue("server.executor-service.max-pool-size", "app-value", appOnly); assertNoValue("com.acme.size", appOnly); assertNoValue("com/ACME/size", appOnly); assertNoValue("server/executor-service/max-pool-size", appOnly); Config appAndSys = Config.builder(appSource) .disableEnvironmentVariablesSource() .build(); assertValue("app.key", "app-value", appAndSys); assertValue("com.ACME.size", "sys-prop-value", appAndSys); assertValue("server.executor-service.max-pool-size", "app-value", appAndSys); assertNoValue("com.acme.size", appOnly); assertNoValue("com/ACME/size", appAndSys); assertNoValue("server/executor-service/max-pool-size", appAndSys); Config appAndEnv = Config.builder(appSource) .disableSystemPropertiesSource() .build(); assertValue("app.key", "app-value", appAndEnv); assertValue("com.ACME.size", "mapped-env-value", appAndEnv); assertValue("server.executor-service.max-pool-size", "mapped-env-value", appAndEnv); assertValue("com.acme.size","mapped-env-value", appAndEnv); assertValue("com/ACME/size", "mapped-env-value", appAndEnv); assertValue("server/executor-service/max-pool-size", "mapped-env-value", appAndEnv); Config appSysAndEnv = Config.builder(appSource) .build(); assertValue("app.key", "app-value", appSysAndEnv); assertValue("com.ACME.size", "sys-prop-value", appSysAndEnv); assertValue("server.executor-service.max-pool-size", "mapped-env-value", appSysAndEnv); assertValue("com.acme.size","mapped-env-value", appAndEnv); assertValue("com/ACME/size", "mapped-env-value", appSysAndEnv); assertValue("server/executor-service/max-pool-size", "mapped-env-value", appSysAndEnv); }
public static ConfigSource create(Config config) { return ConfigSources.create(config.asMap().get()).get(); }
ConfigSources { public static ConfigSource create(Config config) { return ConfigSources.create(config.asMap().get()).get(); } }
ConfigSources { public static ConfigSource create(Config config) { return ConfigSources.create(config.asMap().get()).get(); } private  ConfigSources(); }
ConfigSources { public static ConfigSource create(Config config) { return ConfigSources.create(config.asMap().get()).get(); } private  ConfigSources(); static ConfigSource empty(); static ConfigSource create(Config config); static NodeConfigSource create(ConfigNode.ObjectNode objectNode); static ConfigSource create(InputStream data, String mediaType); static ConfigSource create(String content, String mediaType); static MapConfigSource.Builder create(Map<String, String> map); static MapConfigSource.Builder create(Map<String, String> map, String name); static MapConfigSource.Builder create(Properties properties); static MapConfigSource.Builder create(Properties properties, String name); static ConfigSource prefixed(String key, Supplier<? extends ConfigSource> sourceSupplier); static SystemPropertiesConfigSource.Builder systemProperties(); static MapConfigSource environmentVariables(); static ClasspathConfigSource.Builder classpath(String resource); static List<UrlConfigSource.Builder> classpathAll(String resource); static FileConfigSource.Builder file(String path); static FileConfigSource.Builder file(Path path); static DirectoryConfigSource.Builder directory(String path); static UrlConfigSource.Builder url(URL url); }
ConfigSources { public static ConfigSource create(Config config) { return ConfigSources.create(config.asMap().get()).get(); } private  ConfigSources(); static ConfigSource empty(); static ConfigSource create(Config config); static NodeConfigSource create(ConfigNode.ObjectNode objectNode); static ConfigSource create(InputStream data, String mediaType); static ConfigSource create(String content, String mediaType); static MapConfigSource.Builder create(Map<String, String> map); static MapConfigSource.Builder create(Map<String, String> map, String name); static MapConfigSource.Builder create(Properties properties); static MapConfigSource.Builder create(Properties properties, String name); static ConfigSource prefixed(String key, Supplier<? extends ConfigSource> sourceSupplier); static SystemPropertiesConfigSource.Builder systemProperties(); static MapConfigSource environmentVariables(); static ClasspathConfigSource.Builder classpath(String resource); static List<UrlConfigSource.Builder> classpathAll(String resource); static FileConfigSource.Builder file(String path); static FileConfigSource.Builder file(Path path); static DirectoryConfigSource.Builder directory(String path); static UrlConfigSource.Builder url(URL url);  }