title: Consider marking one of the beans as @Primary
body: <p>In my Java spring application, I have</p>
  
  <pre><code>public class BinarySearchImpl {
  
      @Autowired
      @Qualifier("Quick")
      SortAlgorithem sorter;
  
      Log log=LogFactory.getLog(BinarySearchImpl.class);
  
      public BinarySearchImpl(SortAlgorithem sorter) {
          log.info("Binary Search Bean is created");
          this.sorter=sorter;
      }
  </code></pre>
  
  <p><code>SortAlgorithem</code> is an interface which makes my application loosely coupled:</p>
  
  <pre><code>public interface SortAlgorithem {
  
      public int[] sort(int[] arrayNumbers);
  
  }
  </code></pre>
  
  <p>And then there are 2 implementations for this interface. One is <code>BubbleSort</code>:</p>
  
  <pre><code>@Component
  @Qualifier("Bubble")
  public class BubbleSort implements SortAlgorithem {
  
      Log log=LogFactory.getLog(BubbleSort.class);
  
      public int[] sort(int[] numbers) {
          log.info("Bubble sort is called");
          return numbers;
      }
  }
  </code></pre>
  
  <p>and the other is <code>QuickSort</code>:</p>
  
  <pre><code>@Component
  @Qualifier("Quick")
  //@Primary
  public class QuickSort implements SortAlgorithem{
  
      Log log= LogFactory.getLog(QuickSort.class);
  
      public int[] sort(int[] numbers) {
          log.info("Quick Sort is called");
          return numbers;
      }
  
  }
  </code></pre>
  
  <p>At the end, when I call my app it complains with this message:</p>
  
  <pre><code>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><strong>I am wondering... Why <code>@Qualifier</code> annotation does not work?</strong></p>