Skip to content

Response with type ParameterizedType not working with WebClient #48

@TopoDiFogna

Description

@TopoDiFogna

Describe the bug
Using spring cloud square 0.4.1

When creating an interface for retrofit and declaring a return type which is a parameterized class doesn't allow the application to start due to a ClassCastException in WebClientCallAdapterFactory#81 or, if not wrapping inside a Mono/Flux, WebClientCallAdapterFactory#87

The ReactorCallAdapterFactory used in com.jakewharton.retrofit:retrofit2-reactor-adapter allows such things, but then we lose the feature of a fully non-blocking client.

Also trying to use spring-cloud-square-retrofit + spring-cloud-square-okhttp does not work in webflux applications since a HttpMessageConverters bean is not created due to Conditional annotations.

Sample
Just create an application with spring webflux and an interface like the following:

@RetrofitClient(name ="whatever")
public interface MyClient {

@GET("/something")
Flux<MyType<MyObject>> getMyTypeWithMyObject();

}

And include in your pom

  • spring-cloud-square-retrofit-webclient
  • spring-boot-starter-webflux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions