I've tried to use Microprofile Config in Java SE to inject configuration, but I was greeted by the following exception:
Exception in thread "main" org.apache.webbeans.exception.WebBeansDeploymentException: jakarta.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type java.lang.String Qualifiers: [@org.eclipse.microprofile.config.inject.ConfigProperty(name="test.property", defaultValue="org.eclipse.microprofile.config.configproperty.unconfigureddvalue")] for injection into Field Injection Point, field name : testProperty, Bean Owner : [OurBean, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,me.noip.ksmigrod.spikes.cdiconfig.OurBean], Qualifiers:[jakarta.enterprise.inject.Default,jakarta.enterprise.inject.Any]] found beans: String, WebBeansType:PRODUCERMETHOD, Name:null, API Types:[java.io.Serializable,java.lang.CharSequence,java.lang.constant.ConstantDesc,java.lang.Comparable<String>,java.lang.String,java.lang.Object,java.lang.constant.Constable], Qualifiers:[jakarta.enterprise.inject.Any,org.eclipse.microprofile.config.inject.ConfigProperty], Producer Method: protected java.lang.String io.smallrye.config.inject.ConfigProducer.produceStringConfigProperty(jakarta.enterprise.inject.spi.InjectionPoint) from jar:file:/home/ksm/IdeaProjects/spikes/cdi-config/target/lib/smallrye-config-3.11.1.jar!/io/smallrye/config/inject/ConfigProducer.class String, WebBeansType:PRODUCERMETHOD, Name:null, API Types:[java.io.Serializable,java.lang.CharSequence,java.lang.constant.ConstantDesc,java.lang.Comparable<String>,java.lang.String,java.lang.Object,java.lang.constant.Constable], Qualifiers:[jakarta.enterprise.inject.Any,org.eclipse.microprofile.config.inject.ConfigProperty], Producer Method: protected java.lang.String io.smallrye.config.inject.ConfigProducer.produceStringConfigProperty(jakarta.enterprise.inject.spi.InjectionPoint) from jar:file:/home/ksm/IdeaProjects/spikes/cdi-config/target/lib/smallrye-config-3.11.1.jar!/io/smallrye/config/inject/ConfigProducer.class This message refers to the same metod of the same bean twice, which suggests a bug. I've made a minimal example of that error, and published it on github, README file for this project contains full stacktrace. https://github.com/ksmigrod/cdi-config/ Project runs with Weld. The project builds with OpenWebBeans, but fails at runtime with AmbiguousResolutionException. Is it a bug in OWB, or is there something wrong with my code? Regards, Krzysztof Śmigrodzki
