0

So im trying to use the @client annotation when making external calls..

    @Client("/api/external/call")
    @Header(name = ACCEPT, value = "application/json")
    public interface ExternalCall{
    
        @Get
        MyResponse Call();
    }

now im not sure should the @Client be like @Client("http://host") and have the @Get("/api/external/call")

I both but whenever i try to run the app i get the following error

Unexpected error occurred: All possible Introduction advise exhausted and no implementation found for method: MyResponse Call() io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: MyResponse Call()

Not sure why this is...

user1555190
  • 2,803
  • 8
  • 47
  • 80
  • I haven't seen that error before. There is a [Micronaut HTTP Client guide](https://guides.micronaut.io/latest/micronaut-http-client.html) and [user documentation](https://docs.micronaut.io/latest/guide/#clientAnnotation) that should be helpful. Short answer is that the combination of `@Client` and `@Get` should be reachable. – ShingJo Jul 13 '22 at 18:48
  • it works if i use a class and a http client... but i wanted to use the @Get – user1555190 Jul 13 '22 at 20:50
  • 1
    Make sure you use correct Get annotation – Denis Jul 14 '22 at 06:40

2 Answers2

0

now im not sure should the @Client be like @Client("http://host") and have the @Get("/api/external/call")

If you had this:

 @Client("http://host")
 public interface ExternalCall{
    
        @Get("/api/external/call")
        MyResponse Call();
 }

When you invoke that Call() method, that should generate a GET request to http://host/api/external/call.

Your question mentions Greeting serviceAGreeting() and MyResponse Call(). It isn't clear how those relate to the code you show.

Jeff Scott Brown
  • 26,804
  • 2
  • 30
  • 47
  • That was a incorrect copy and paste.... I tried the above but it gives the same message... its as though the implementation has not been generated by micronaut – user1555190 Jul 13 '22 at 20:51
  • btw if i use a httpClient client = new HttpClient()...... i can get it to work... but i wanted to use this interface annotated methof. – user1555190 Jul 13 '22 at 20:52
  • "I tried the above but it gives the same message." - That code is valid and does work. I expect you have soemthing wrong in your build and/or run configuration. If you can share a simple sample project which demonstrates the problem I would be happy to send you a PR. – Jeff Scott Brown Aug 08 '22 at 18:27
0

I believe that you're missing the following dependency:

<dependency>
    <groupId>io.micronaut</groupId>
    <artifactId>micronaut-http-client</artifactId>
</dependency>
Roar S.
  • 8,103
  • 1
  • 15
  • 37