Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving the response body as a List of POJOs fails with RestClient but passes with WebTestClient #31574

Closed
donalmurtagh opened this issue Nov 8, 2023 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@donalmurtagh
Copy link

donalmurtagh commented Nov 8, 2023

Affects: spring 6.1.0-RC2 with spring boot 3.2.0-RC2 and JDK21

Description
I've attached a sample Spring Boot application with a single endpoint that returns the response as a wrapped List<Label>. When I retrieve the response with WebTestClient the list (correctly) contains Label instances, but when I retrieve the response with RestClient the list contains Map instances.

In both cases, I've used the same ParameterizedTypeReference when retrieving the response

Steps to Reproduce
demo.zip

The application contains 2 integration tests, one of which invokes the endpoint with a RestClient and the other uses WebTestClient. The latter test passes, but the former fails.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 8, 2023
@donalmurtagh donalmurtagh changed the title Retrieving the response as a List of POJOs fails with RestClient but passes with WebTestClient Retrieving the response body as a List of POJOs fails with RestClient but passes with WebTestClient Nov 8, 2023
@sdeleuze sdeleuze self-assigned this Nov 9, 2023
@sdeleuze sdeleuze added type: bug A general bug in: web Issues in web modules (web, webmvc, webflux, websocket) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 9, 2023
@sdeleuze sdeleuze added this to the 6.1.0 milestone Nov 9, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented Nov 9, 2023

Likely caused by the fact contextClass should be null for client side use case (it is currently set to bodyClass).

@donalmurtagh
Copy link
Author

@sdeleuze thanks for the fix. I've confirmed that this is resolved in the latest 6.1.0-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants