I can use @Autowired in controller like

```java
@RestController
public class Index {

    @Autowired
    HttpServletResponse response;

    @GetMapping("/")
    void index() throws IOException {
        response.sendRedirect("http://example.com");
    }
}

```

it works;

But when I try to test this class using @MockBean like

```java
@RunWith(SpringRunner.class)
@SpringBootTest
public class IndexTest {

    @Autowired
    Index index;

    @MockBean
    HttpServletResponse response;

    @Test
    public void testIndex() throws IOException {
        index.index();
    }
}

```

it throw an exception and say

```
Description:

Field response in com.example.demo.Index required a single bean, but 2 were found:
    - com.sun.proxy.$Proxy69@425d5d46: a programmatically registered singleton  - javax.servlet.http.HttpServletResponse#0: defined in null

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

```

How to fix it?