diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java index 42ba62f80a198..551cc2acf9383 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java @@ -420,8 +420,10 @@ private static void populateTypicalProperty(MethodCreator methodCreator, ResultH createWriteValue(methodCreator, configObject, field, setter, useFieldAccess, setterValue); } - configPropertyBuildItemCandidates - .add(new ConfigPropertyBuildItemCandidate(field.name(), fullConfigName, fieldType)); + if (field.type().kind() != Type.Kind.PRIMITIVE) { // the JVM assigns primitive types a default even though it doesn't show up in the bytecode + configPropertyBuildItemCandidates + .add(new ConfigPropertyBuildItemCandidate(field.name(), fullConfigName, fieldType)); + } } private static String getFullConfigName(String prefixStr, ConfigProperties.NamingStrategy namingStrategy, FieldInfo field) { diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java index 83dfd5c454596..433d8a2fff1f7 100644 --- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java +++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java @@ -40,6 +40,7 @@ public void testConfiguredValues() { assertEquals(Arrays.asList(1, 2, 3, 4), dummyBean.getNumbers()); assertEquals("default", dummyBean.getUnset()); assertTrue(dummyBean.isBoolWithDefault()); + assertFalse(dummyBean.isUnsetBoolean()); assertTrue(dummyBean.getOptionalInt().isPresent()); assertEquals(100, dummyBean.getOptionalInt().get()); assertFalse(dummyBean.getOptionalString().isPresent()); @@ -69,6 +70,10 @@ boolean isBoolWithDefault() { return dummyProperties.boolWithDefault; } + boolean isUnsetBoolean() { + return dummyProperties.unsetBoolean; + } + Optional getOptionalInt() { return dummyProperties.optionalInt; } @@ -92,6 +97,7 @@ public static class DummyProperties { public String name; public String unset = "default"; public boolean boolWithDefault = false; + public boolean unsetBoolean; public List numbers; public Optional optionalInt; public Optional optionalString;