title: Difference between Import/Autowire/MockBean/ContextConfiguration in Spring test
body: <p>I frequently see Spring test like this:</p>
  <pre><code>@WebMvcTest(controllers = MyController.class)
  @Import({DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaConfig.class, MyService.class})
  @ContextConfiguration(classes = AppConfig.class) 
  @MockBeans({@MockBean(MyLocationProvider.class), @MockBean(MyOtherService.class)})
  public class MyServiceControllerTest {
  
      @Autowired
      private MockMvc mockMvc;
  
      @Autowired
      private ObjectMapper objectMapper;
  
      @Autowired
      private MyJobRepository myJobRepository;
  
      @MockBean
      private MyComplicatedService myComplicatedService;
      
      ....
  }
  </code></pre>
  <p>I can see there are @Import, @ContextConfiguration, @MockBeans(Before the class), @MockBeans(As fields), @Autowired.</p>
  <p>I can understand the different between @MockBeans(Before the class), @MockBeans(As fields), @Autowired. But I am not sure what is the difference between @Import and @ContextConfiguration.</p>
  <p>Can someone help?</p>