title: Spring boot test: MockedBean conflicts with others
body: <p>Currently, I've two <code>RestTemplate</code> beans:</p>
  
  <pre><code>@Bean
  @Primary
  public RestTemplate jwtRestTemplate(
      RestTemplateBuilder builder,
      JWTService jwtService) {
  
          return builder
              .additionalInterceptors(
                  Collections.singletonList(
                      new JWTHeaderRequestInterceptor(jwtService)
                  )
              )
              .build();
  }
  
  @Bean
  public RestTemplate rawRestTemplate(RestTemplateBuilder builder) {
      return builder.build();
  }
  </code></pre>
  
  <p>The first one is primary and the other one is requested by <code>@Qualifier("rawRestTemplate")</code>.</p>
  
  <p>However, I'm mocking a <code>ResTemplate</code> into my tests:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest()
  public class AuditoryTest {
  
      @MockBean()
      private RestTemplate frontOfficeRestTemplate;
  
      @Autowired
      private DocumentServiceBackOffice documentService;
  </code></pre>
  
  <p><code>DocumentServiceBackOffice</code> constructor is:</p>
  
  <pre><code>public DocumentServiceBackOffice(RestTemplate restTemplate);
  </code></pre>
  
  <p>I'm getting an exception:</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Parameter 0 of constructor in net.gencat.transversal.espaidoc.backoffice.service.DocumentServiceBackOffice required a single bean, but 2 were found:
      - rawRestTemplate: defined by method 'rawRestTemplate' in class path resource [net/gencat/transversal/espaidoc/backoffice/config/BackOfficeConfiguration.class]
      - jwtRestTemplate: defined by method 'createMock' 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
  </code></pre>
  
  <p>Message is pretty clear, but I don't quite figure out how to solve that.</p>
  
  <p>Any ideas?</p>