snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

ConfigMapping and CDI error #373

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

Describe the bug

When switching from the Deprecated io.quarkus.arc.config.ConfigProperties to io.smallrye.config.ConfigMapping as described in the javadoc we get CDI errors

Expected behavior

Expected behaviour is behaviour prior to the change. All beans are injected correctly

Actual behavior

the class

@ConfigMapping(prefix = "foo")
public interface QuarkusConfig extends Config {
}

no longer gets injected in constructors like:

@Inject
public  Foo(@Any Config) {
}

with errors like:

[1] Unsatisfied dependency for type org.projectnessie.services.config.ServerConfig and qualifiers [@Any]
    - java member: org.projectnessie.services.rest.ConfigResource#config
    - declared on CLASS bean [types=[org.projectnessie.api.ConfigApi, org.projectnessie.services.rest.ConfigResource, java.lang.Object], qualifiers=[@Default, @Any], target=org.projectnessie.services.rest.ConfigResource]

To Reproduce

public class Foo {
 @Inject
 public Foo(@Any FooConfig) {
 }
}

public interface FooConfig {
  String foo()
}

@ConfigMapping(prefix = "foo")
public interface QuarkusFooConfig extends FooConfig {
}

or projectnessie/nessie#1563

Environment (please complete the following information):

Output of uname -a or ver

Linux xxx 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

GraalVM version (if different from Java)

Quarkus version or git rev

2.0.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/xxx/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-77-generic", arch: "amd64", family: "unix"


https://github.com/quarkusio/quarkus/issues/18524


$upstream:18524$