question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@RestClient - the current @Target is wrong

See original GitHub issue

The current value is @Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD}).

  1. It’s not possible to inject a rest client into a method or a constructor parameter (missing ElementType.PARAMETER).
  2. It’s not possible to define test mocks for rest client interfaces (missing ElementType.TYPE).

CDI qualifiers typically define the target as follows: @Target({METHOD, FIELD, PARAMETER, TYPE}). ElementType.CONSTRUCTOR is completely useless.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andreas-eberlecommented, Mar 9, 2020

Good idea. I added it to my PR. Thanks for the input!

0reactions
mkoubacommented, Mar 9, 2020

It could be useful when creating mocks:

@Path("/echo")
@RegisterRestClient
public interface EchoClient {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Consumes(MediaType.TEXT_PLAIN)
    String echo(@QueryParam("message") String message);
}

@Priority(1)
@Alternative // Takes precedence over the bean provided by the MP Rest Client impl
@RestClient
class MockEchoClient implements EchoClient {
    public String echo(String message) {
       return "mock!";
   }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error showing while using RestSharp RestClient method
The error is gone because ExecuteAsync takes a RestRequest argument. Now you have to make sure to handle the async nature correctly, by...
Read more >
Connection is being rejected for localhost · Issue #523 - GitHub
Symptom: Connection is being rejected. The service isn't running on the server, or incorrect proxy settings in vscode, or a firewall is blocking...
Read more >
Using the REST Client Reactive - Quarkus
This guide explains how to use the REST Client Reactive in order to interact with REST APIs. ... quarkus.rest-client.extensions-api.verify-host=false ...
Read more >
Missing definitions (Versions) - MSDN - Microsoft
I've updated the target framework to 4.6. I can't find any documentation on RestClient. Tuesday, March 31, 2020 9:11 ...
Read more >
Home of Quarkus Cheat-Sheet - GitHub Pages
json.print-details. Detailed caller information should be logged (default: false). Rest Client. Quarkus implements ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found