OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.43k stars 1.92k forks source link

Decode Failed making field 'java.util.concurrent.CompletableFuture#result' accessible; either change its visibility or write a custom TypeAdapter for its declaring type #1875

Closed Shakesbeer333 closed 1 year ago

Shakesbeer333 commented 1 year ago

Hi,

following the instruction of the docu

    interface FeignClient {
        @RequestLine("GET /")
        CompletableFuture<ResponseEntity> hello();
    }

    FeignClient feignClient = AsyncFeign.builder()
            .decoder(new GsonDecoder())
            .target(FeignClient.class, "http://localhost:8080");

    assertEquals("hello", feignClient.hello().get());

I get the following Error

Decode Failed making field 'java.util.concurrent.CompletableFuture#result' accessible; either change its visibility or write a custom TypeAdapter for its declaring type

I'um using feign-core 11.8 and feign-gso 11.8

Shakesbeer333 commented 1 year ago

The REST API works fine using Java HTTP Client

Marcono1234 commented 1 year ago

Might be related to / duplicate of #1453?

Could you try Feign version 12.0 or newer please? In my local tests starting with Feign 12.0 this code work as expected and no exception is thrown anymore. I don't know yet which specific commit fixed this though.

Shakesbeer333 commented 1 year ago

Yes, it works with Feign >= 12.0