Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3259

Proxy Framework fails to Produce Mono<T> at runtime when proxying a java Interface

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.2.2.Final
    • 6.2.1.Final
    • Providers
    • None
    • 3
    • Hide

      versions:

      • Spring Boot 3.0.0 GA 
      • Resteasy 6.2.1.FINAL

      Prepare the following remote service description in the test class:

       @Path("/api/v1") private interface CarRemoteService { @Path("car/metadata") @GET Mono<String> getCarMetadata(); } 

      and the following server implementation in a springboot app:

       @RestController @RequestMapping(value = "api/v1", produces = APPLICATION_JSON_VALUE) public class MyRestController { @GetMapping("/car/metadata") String getCarMetadata() { return "metadata"; } } 

      Then run the following test:

       @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class MyRestControllerTest { 
      @Value("${local.server.port}") 
      private int port; 
      private Client client; 
      
      @Path("/api/v1") 
      private interface CarRemoteService { 
      
      @Path("car/metadata") 
      @GET Mono<String> getCarMetadata(); } 
      
      @BeforeEach 
      void setUp() { client = ClientBuilder.newClient(); } 
      
      @Test 
      void givenProxyFrameworkAPI_callServerWithMonoBasedClient() { 
      ResteasyWebTarget target = (ResteasyWebTarget) client.target("http://localhost:" + port); 
      
      final CarRemoteService carRemoteService = target.proxy(CarRemoteService.class); assertThat(carRemoteService.getCarMetadata().block()).isEqualTo("metadata"); 
      } 
      }
      Show
      versions: Spring Boot 3.0.0 GA  Resteasy 6.2.1.FINAL Prepare the following remote service description in the test class: @Path( "/api/v1" ) private interface CarRemoteService { @Path( "car/metadata" ) @GET Mono< String > getCarMetadata(); } and the following server implementation in a springboot app: @RestController @RequestMapping(value = "api/v1" , produces = APPLICATION_JSON_VALUE) public class MyRestController { @GetMapping( "/car/metadata" ) String getCarMetadata() { return "metadata" ; } } Then run the following test: @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class MyRestControllerTest { @Value( "${local.server.port}" ) private int port; private Client client; @Path( "/api/v1" ) private interface CarRemoteService { @Path( "car/metadata" ) @GET Mono< String > getCarMetadata(); } @BeforeEach void setUp() { client = ClientBuilder.newClient(); } @Test void givenProxyFrameworkAPI_callServerWithMonoBasedClient() { ResteasyWebTarget target = (ResteasyWebTarget) client.target( "http: //localhost:" + port); final CarRemoteService carRemoteService = target.proxy(CarRemoteService.class); assertThat(carRemoteService.getCarMetadata().block()).isEqualTo( "metadata" ); } }
    • Compatibility/Configuration
    • In Progress

      Given a Java Interface that describes a remote Service using Mono<T> and Flux<T> as method return types, and given that we depend on resteasy-reactor, when calling proxy(Interface.class) and they calling the proper methods on the generated proxy, weird errors about not finding the proper messageBodyReader are shown.
      summary Proxy Framework fails to Produce Mono<T> at runtime when proxying a java Interface

              jperkins-rhn James Perkins
              douuuuud romain Monfollet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: