Repository: quarkusio/quarkus
Issue: MP Config - programmatic lookup of "custom" type config property fails

### Describe the bug

If there's a `Provider/Instance` injection point whose required type is not handled by the `ConfigProducer` (aka "custom type") then a synthetic bean with a wrong set of bean types is generated. The bean has the type `Provider<Foo>/Instance<Foo>` instead of `Foo`. As a result, if there's an injection point like `@ConfigProperty(name = "foo.val") Provider<Foo> foo`  then `foo.get()` results in an `UnsatisfiedResolutionException`.

Note that this error only occurs if there is no regular injection point for the given custom type, i.e. no exception is thrown if there's also `@ConfigProperty(name = "foo.val") Foo foo`.

### Quarkus version or git rev

999-SNAPSHOT

Changed files:
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java

diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
index e442f72837c..53808672a5a 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
@@ -106,7 +106,7 @@ void registerCustomConfigBeanTypes(BeanDiscoveryFinishedBuildItem beanDiscovery,
             AnnotationInstance configProperty = injectionPoint.getRequiredQualifier(MP_CONFIG_PROPERTY_NAME);
             if (configProperty != null) {
                 // Register a custom bean for injection points that are not handled by ConfigProducer
-                Type injectedType = injectionPoint.getType();
+                Type injectedType = injectionPoint.getRequiredType();
                 if (!isHandledByProducers(injectedType)) {
                     customBeanTypes.add(injectedType);
                 }
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
index 0ddcf2d264d..1762af06bdf 100644
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
+++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
@@ -4,6 +4,7 @@
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
+import javax.inject.Provider;
 
 import org.eclipse.microprofile.config.inject.ConfigProperty;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
@@ -17,8 +18,8 @@ public class ConfigImplicitConverterTest {
     @RegisterExtension
     static final QuarkusUnitTest config = new QuarkusUnitTest()
             .withApplicationRoot((jar) -> jar
-                    .addClasses(Configured.class)
-                    .addAsResource(new StringAsset("foo=1"), "application.properties"));
+                    .addClasses(Configured.class, Foo.class, Bar.class)
+                    .addAsResource(new StringAsset("foo=1\\nbar=1"), "application.properties"));
 
     @Inject
     Configured configured;
@@ -26,6 +27,7 @@ public class ConfigImplicitConverterTest {
     @Test
     public void testFoo() {
         assertEquals("1", configured.getFooValue());
+        assertEquals("1", configured.getBarProviderValue());
     }
 
     @ApplicationScoped
@@ -35,9 +37,17 @@ static class Configured {
         @ConfigProperty(name = "foo")
         Foo foo;
 
+        @ConfigProperty(name = "bar")
+        Provider<Bar> barProvider;
+
         String getFooValue() {
             return foo != null ? foo.value : null;
         }
+
+        String getBarProviderValue() {
+            return barProvider.get().value;
+        }
+
     }
 
     public static class Foo {
@@ -50,4 +60,14 @@ public Foo(String value) {
 
     }
 
+    public static class Bar {
+
+        String value;
+
+        public Bar(String value) {
+            this.value = value;
+        }
+
+    }
+
 }