title: I don't konw Why Could not autowire. No beans of 'ObjectMapper' type found. (Annotation Error)
body: <p>I am working on a spring boot project. However, when <code>@WebMvcTest</code> annotation is used, there is no problem in objectmapper, but when using <code>@AutoConfigureMockMvc</code>, an error occurs in objectmapper. What's the problem?</p>
  <pre class="lang-java prettyprint-override"><code>@SpringBootTest
  @ExtendWith(SpringExtension.class)
  @AutoConfigureMockMvc
  class EventControllerTest {
  
      @Autowired MockMvc mockMvc;
      @Autowired ObjectMapper objectMapper;
  
      @Test
      void createEVent() throws Exception {
          Event event = Event.builder()
                  .id(100)
                  .name(&quot;Spring&quot;)
                  .description(&quot;REST API Development with Spring&quot;)
                  .beginEventDateTime(LocalDateTime.of(2021, 10, 30, 12, 00))
                  .closeEnrollmentDateTime(LocalDateTime.of(2021, 10, 31, 12, 00))
                  .beginEnrollmentDateTime(LocalDateTime.of(2021, 11, 01, 12, 00))
                  .endEventDateTime(LocalDateTime.of(2021, 11, 02, 12, 00))
                  .basePrice(100)
                  .maxPrice(200)
                  .limitOfEnrollment(100)
                  .location(&quot;Tokyo&quot;)
                  .free(true)
                  .offline(false)
                  .build();
  
          mockMvc.perform(post(&quot;/api/event&quot;)
                  .contentType(MediaType.APPLICATION_JSON)
                  .accept(MediaTypes.HAL_JSON)
                  .content(objectMapper.writeValueAsString(event)))
                  .andDo(print())
                  .andExpect(status().isCreated())
                  .andExpect(jsonPath(&quot;id&quot;).exists())
                  .andExpect(header().exists(HttpHeaders.LOCATION))
                  .andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaTypes.HAL_JSON_VALUE))
                  .andExpect(jsonPath(&quot;id&quot;).value(Matchers.not(100)))
                  .andExpect(jsonPath(&quot;free&quot;).value(Matchers.not(true)));
      }
  }
  </code></pre>