Skip to content

Custom Jackson serializers are no longer included in WebMvcTest and WebFluxTest #47864

@donalmurtagh

Description

@donalmurtagh

In Spring Boot v4.0.0-RC1, a @WebMvcTest does not include custom JSON serializers when a controller is tested.

Passing Example for v4.0.0-M3

Run the tests in ItemControllerTests in the rest-test-client-v4-M3 branch of the sample application. The tests pass, because the response object is serialized via ItemSerializer.

Failing Example for v4.0.0-RC1

Run the tests in ItemControllerTests in the rest-test-client-v4-RC1 branch of the sample application. The tests fail, because the response object is serialized via default serialization, i.e. ItemSerializer is ignored.

Differences between these branches

  • The Spring Boot version (obviously)
  • The module/starter names that were changed between M3 and RC1, e.g. spring-boot-starter-web replaced by spring-boot-starter-webmvc
  • API changes such as @JsonComponent renamed to @JacksonComponent and @WebMvcTest moved to a different package

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions