-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error reading ConfigMapping in constructor injection #19387
Comments
/cc @radcortez |
Hum... it should work. Let me have a look. |
@mweber03 you are missing the I also added a test to Quarkus and it does work as expected. |
@radcortez I disagree that your test actually tests anything. Your test works because What I was hoping to do is share the interface class between two configs, but I can't do this if the config prefix needs to be on the interface class. This actually used to work with the quarkus arc Example of what I was trying to do: public interface Service3Config {
String name();
int num();
}
public class Service3Handler {
@Inject
public Service3Handler(@ConfigMapping(prefix = "app.data1") final Service3Config config1,
@ConfigMapping(prefix = "app.data2") final Service3Config config2) {
...
}
} |
So from CDI point of view the |
The annotation in the constructor is to override the prefix used in the injection point. @mweber03 yes, the config mapping interface requires the annotation and the injection in the constructor works without it, but you can definitely reuse the same interface with different prefixes by overriding the injection point with the |
Describe the bug
I want to specify a
@ConfigMapping
on a parameter in the injection constructor, such that it is used then thrown away. This causes an unsatisfied dependency error on build. This may be unsupported behavior, in which case feel free to retag this as an enhancement.Expected behavior
The ability to read config mappings in an injection constructor.
Actual behavior
How to Reproduce?
Reproducer:
service3
in https://github.com/mweber03/quarkus-test./gradlew service3:quarkusBuild
application.yaml
java
Output of
uname -a
orver
Ubuntu 20.04
Output of
java -version
OpenJDK 11.0.11
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.1.2
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 7.1.1
Additional information
No response
The text was updated successfully, but these errors were encountered: