title: Error: Unable to find @SpringBootConfiguration when doing @WebMvcTest for Spring Controller
body: <p>I am testing my controller given below</p>
  
  <pre><code>@Controller
  public class MasterController {
  
  @GetMapping("/")
  public String goLoginPage(){
      return "index";
  }
  }
  </code></pre>
  
  <p>I am following <a href="https://spring.io/guides/gs/testing-web/" rel="noreferrer">this</a> Spring documentation to test my controller.
  Now, I want to test my controller by just instantiating the web layer and not the whole Spring context as given in the documentation. Below is my code for the same.</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest
  public class MasterControllerTestWithWebLayer {
  
  @Autowired
  MockMvc mockMvc;
  
  @Autowired
  MasterController masterController;
  
  
  @Before
  public void setUp() throws Exception {
  }
  
  @After
  public void tearDown() throws Exception {
  }
  
  @Test
  public void testLoginHome() throws Exception{
      mockMvc.perform(get("/"))
      .andExpect(status().isOk())
      .andExpect(view().name("index"));
  }
  
  }
  </code></pre>
  
  <p>When I run this test I get the error <code>Unable to find @SpringBootConfiguration,...etc</code>. But I am confused why it is asking for Spring configuration when we do not want it to instantiate it but want to use only the web layer. Kindly point me to the right direction what is happening here. And also how to fix this. Thanks</p>