Response with type ParameterizedType not working with WebClient
See original GitHub issueDescribe 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
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top GitHub Comments
Hi @OlgaMaciaszek I’d be glad to work on some bug fixes and smaller enhancements. We’re using Square to define a declarative web client. I assume with the migration to Spring 6 we will also go for the new solution.
Thanks, @michael-wirth - it will be very helpful. I will definitely get to your PRs, but till the end of Nov work on anything unrelated to the
2022.x
release might be slow on our side. We will definitely catch up with other backlogs then, however.