diff --git a/config/src/main/java/io/scalecube/config/ObjectPropertyField.java b/config/src/main/java/io/scalecube/config/ObjectPropertyField.java index d2d86a4..794db51 100644 --- a/config/src/main/java/io/scalecube/config/ObjectPropertyField.java +++ b/config/src/main/java/io/scalecube/config/ObjectPropertyField.java @@ -86,8 +86,7 @@ private boolean isMultimap(ParameterizedType paramType) { } else if (type == Long.TYPE || type == Long.class) { return Long::parseLong; } else { - throw new IllegalArgumentException( - "ObjectPropertyField: unsupported type on field: " + field); + return Function.identity(); } } diff --git a/config/src/test/java/io/scalecube/config/ObjectConfigPropertyTest.java b/config/src/test/java/io/scalecube/config/ObjectConfigPropertyTest.java index 66c7be7..994d548 100644 --- a/config/src/test/java/io/scalecube/config/ObjectConfigPropertyTest.java +++ b/config/src/test/java/io/scalecube/config/ObjectConfigPropertyTest.java @@ -401,6 +401,27 @@ void testSkipStaticOrFinalFieldInObjectPropertryClass() { assertEquals(1, config.finalInt); } + @Test + void testSkipInjectedConfigPojo() { + when(configSource.loadConfig()) + .thenReturn( + toConfigProps( + mapBuilder() + .put("io.scalecube.config.user", "user") + .put("io.scalecube.config.password", "password") + .build())); + + ConfigRegistryImpl configRegistry = newConfigRegistry(configSource); + + final SkipInjectedConfigPojo configPojo = + configRegistry.objectProperty(SkipInjectedConfigPojo.class).value().get(); + + assertEquals("user", configPojo.user); + assertEquals("password", configPojo.password); + assertNotNull(configPojo.testConfig); + assertNotNull(configPojo.intObjectSettings); + } + // Failure scenarios @Test @@ -552,4 +573,11 @@ public static class ConnectorSettings { public static class IntObjectSettings { int anInt; } + + public static class SkipInjectedConfigPojo { + String user; + String password; + IntObjectSettings intObjectSettings = new IntObjectSettings(); + TestConfig testConfig = new TestConfig(); + } }