Skip to content

WebMvcTest and WebFluxTest do not include Jackson Module beans #22530

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

Closed
jnizet opened this issue Jul 23, 2020 · 1 comment
Closed

WebMvcTest and WebFluxTest do not include Jackson Module beans #22530

jnizet opened this issue Jul 23, 2020 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@jnizet
Copy link
Contributor

jnizet commented Jul 23, 2020

The @JsonTest annotation automatically includes beans of type com.fasterxml.jackson.databind.Module.
So you can test that you've configured Jackson correctly by using a JsonTest, and it will automatically pick up your beans of type Module.

But as soon as you use an @WebMvcTest that relies on this Module bean, it fails because @WebMvcTest does not include beans of type com.fasterxml.jackson.databind.Module (although it does include beans annotated with @JsonComponent, just like @JsonTest).

This is easy enough to workaround, but it's surprising and inconsistent, IMHO.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 23, 2020
@wilkinsona wilkinsona added the for: team-attention An issue we'd like other members of the team to review label Jul 24, 2020
@wilkinsona
Copy link
Member

I think I could be convinced that this is a bug and picking up Module beans doesn't feel particularly likely to break anyone. It feels like a candidate for a fix in 2.2.x to me.

@wilkinsona wilkinsona changed the title WebMvcTest should include beans of type Module WebMvcTest and WebFluxTest do not include Jackson Module beans Jul 24, 2020
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged for: team-attention An issue we'd like other members of the team to review labels Jul 24, 2020
@wilkinsona wilkinsona added this to the 2.2.x milestone Jul 24, 2020
@wilkinsona wilkinsona self-assigned this Jul 27, 2020
@wilkinsona wilkinsona modified the milestones: 2.2.x, 2.2.10 Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants