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.

Comment From: wilkinsona

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.