Skip to content

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

Closed
@donalmurtagh

Description

@donalmurtagh

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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions