You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
changed the title
WebMvcTest should include beans of type Module
WebMvcTest and WebFluxTest do not include Jackson Module beans
Jul 24, 2020
The
@JsonTest
annotation automatically includes beans of typecom.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 typecom.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.
The text was updated successfully, but these errors were encountered: