redhat-developer / redhat-developer/vscode-quarkus
inject/restclient not needed for constructor injection in quarkus
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 79
- Forks
- 31
- Avg merge
- 12h 51m
- Merged PRs (30d)
- 6
Description
I get The Rest Client object should have the @Inject and @RestClient annotations to be injected as a CDI bean.microprofile-restclient(InjectAndRestClientAnnotationMissing) with this code for the api code which works fine in Quarkus:
@ApplicationScoped
public class AppHAContext implements IHAContext {
private HomeAssistantAPI api;
private HomeAssistantWS ws;
public AppHAContext(@RestClient HomeAssistantAPI api, HomeAssistantWS ws) {
this.api = api;
this.ws = ws;
}
@Override
public HomeAssistantAPI getApi() {
return api;
}
public HomeAssistantWS ws() {
return ws;
}
}
quarkus does automatic constructor injection thus @Inject is not required.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the Java constructor example in the issue as the reproduction and trace the diagnostic named microprofile-restclient(InjectAndRestClientAnnotationMissing). Confirm how constructor injection is recognized when @RestClient is present, then verify that the diagnostic no longer reports this valid pattern while still identifying genuinely missing injection annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100