title: Geting java.lang.IllegalStateException: Duplicate mock definition while using @MockBean in test case
body: <p>I have one service class that I want to mock but while running the test I am Getting Caused by: <code>java.lang.IllegalStateException: Duplicate mock definition [MockDefinition@482ba4b1 name = '', typeToMock = com.service.ThirdPartyService, extraInterfaces = set[[empty]], answer = RETURNS_DEFAULTS, serializable = false, reset = AFTER]</code></p>
  
  <p>I have tried to create mock service using @MockBean at class level, field level, and used @Qualifier as well to resolve the issue </p>
  
  <pre class="lang-java prettyprint-override"><code>@Service
  public class ThirdPartyService{
  
  .......................
  
      public String decrypt(String encryptedText) { 
      //third party SDK I am using
          return Service.decrypt.apply(encryptedText);
      }
  .........
  ..............
  }
  
  
      @ComponentScan("com")
      @PropertySource({"classpath:/api.properties", "classpath:/common.properties"})
      @SpringBootConfiguration
      @RunWith(SpringRunner.class)
      @SpringBootTest(classes = {Application.class}, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
      @Transactional
      public class TestControllerTest extends IntegrationTest {
      @MockBean
      ThirdPartyService thirdPartyService;
      @Before
      public void initMocks(){
      MockitoAnnotations.initMocks(this);
      }
  
      @Test
      public void test() throws Exception {
      when(ts.decrypt("encryptedText")).thenReturn("decryptedText")    
      Request req = Request.builder().name("name123").build();
      //written performPost method in some other class
      ResultActions action = performPost("/test", req);
      action.andExpect(status().isOk());  
      }
      }
  
      public class IntegrationTest {
      protected final Gson mapper = new Gson();
      private MockMvc mvc;
      @Autowired
      private WebApplicationContext context;
      public ObjectMapper objectMapper = new ObjectMapper();
      @Before
      public void setup() {
      this.mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
      }}
  </code></pre>
  
  <p>When I am calling Thirdparty service decrypt method then it should return me decryptedText as a string. But getting duplicate mock definition error</p>