Skip to content
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

Unable to inject @GrpcClient in quarkus "The following beans match by type, but none have matching qualifiers" #35855

Closed
denysandriyanov opened this issue Sep 11, 2023 · 2 comments
Labels
area/grpc gRPC env/windows Impacts Windows machines kind/bug Something isn't working

Comments

@denysandriyanov
Copy link

Describe the bug

I am trying to create gRPC client in Quarkus. Did everything according to the documentation.

Placed proto files in src/main/proto: here is the content of the service file

syntax = "proto3";

package userinfo.grpc;

import "UserInfoRequest.proto";
import "UserInfoResponse.proto";

service UserInfoService {
rpc GetUserInfo (UserInfoRequest) returns (UserInfoResponse);
}
added to gradle following dependency:

implementation 'io.quarkus:quarkus-grpc'
When I built the project I saw my gRPC classes generated in

\build\classes\java\quarkus-generated-sources\grpc\userinfo

Expected behavior

@GrpcClient injected without exceptions

Actual behavior

Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type userinfo.grpc.UserInfoService and qualifiers [@default] - java member: <my_package>.userinfo.grpc.IdentityUserInfoProviderGrpc():userInfoService - declared on CLASS bean [types=[<my_package>.userinfo.UserInfoProvider, java.lang.Object, <my_package>.userinfo.grpc.IdentityUserInfoProviderGrpc], qualifiers=[@default, @Any], target=<my_package>.userinfo.grpc.IdentityUserInfoProviderGrpc] The following beans match by type, but none have matching qualifiers: - Bean [class=userinfo.grpc.UserInfoService, qualifiers=[@Any, @io.quarkus.grpc.GrpcClient("userInfoService")]]

How to Reproduce?

https://github.com/denysandriyanov/reproducer

clone
build
run

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.3086]

Output of java -version

17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.3.1

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

gradle-7.6-bin

Additional information

Thank you for looking at this

@denysandriyanov denysandriyanov added the kind/bug Something isn't working label Sep 11, 2023
@quarkus-bot quarkus-bot bot added area/grpc gRPC env/windows Impacts Windows machines labels Sep 11, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 11, 2023

/cc @alesj (grpc), @cescoffier (grpc)

@mkouba
Copy link
Contributor

mkouba commented Sep 15, 2023

It's the @lombok.AllArgsConstructor annotation that causes the problem. According to the docs it generates an all-args constructor for every field in the class. However, in Quarkus if a bean class declares a single constructor then all the arguments are considered injection points. And you can't inject a grpc client without the @GrpcClient qualifier.

Simply remove the annotation. It's not needed at all.

HTH

@mkouba mkouba closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants