java spring-boot spring-mvc spring-test

Error: Unable to find @SpringBootConfiguration when doing @WebMvcTest for Spring Controller

I am testing my controller given below

public class MasterController {
public String goLoginPage(){
return "index";

I am following this 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.

public class MasterControllerTestWithWebLayer {
MockMvc mockMvc;
MasterController masterController;
public void setUp() throws Exception {
public void tearDown() throws Exception {
public void testLoginHome() throws Exception{

When I run this test I get the error Unable to find @SpringBootConfiguration,...etc. 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