snowdrop-zen / quarkus

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

Misleading error messaging from quarkus-rest-client when missing an annotation #144

Closed snowdrop-bot closed 4 years ago

snowdrop-bot commented 4 years ago

Describe the bug in the quarkus-rest-client if you forget to include the @RestClient you get a very misleading error message. A partial example stack trace is below.

Expected behavior A better error message and/or stack trace indicating the problem. Or a compile time error indicating the missing value.

Actual behavior this is the stack you get back (partial)

Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.pophealth.client.HealthDataService and qualifiers [@Default]
    - java member: org.pophealth.googleFit.FitServlet#healthDataService
    - declared on CLASS bean [types=[javax.servlet.ServletConfig, java.io.Serializable, javax.servlet.GenericServlet, com.google.api.client.extensions.servlet.auth.oauth2.AbstractAuthorizationCodeServlet, javax.servlet.Servlet, java.lang.Object, org.pophealth.googleFit.FitServlet, javax.servlet.http.HttpServlet], qualifiers=[@Default, @Any], target=org.pophealth.googleFit.FitServlet]
    at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:487)
    at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
    at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:226)
    ... 14 more

To Reproduce Steps to reproduce the behavior:

  1. Create a Rest client following the guide (https://quarkus.io/guides/rest-client)
  2. Now assume you know what you're doing (you're a clever guy, who needs a guide?) and create another rest client but forget to include @RestClient in the injected service bean. Or just remove it from the injection in step 1.
  3. mvn clean compile quarkus:dev
  4. Get exception

Configuration N/A - follow the rest-client guide for required properties there.

Screenshots (If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

Additional context Part of my stack is because i'm injecting the bean in a servlet but it would be similar elsewhere.

Not a huge issue but the rest-client could be a common getting started flow and the stack that is produced is tough to identify the missing annotation.


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


$upstream:10898$