title: Using @Qualifier and @Bean together in Java Config Spring
body: <p>I have follow code</p>
  <pre><code>interface Drivable {
  
  }
  
  @Component
  class Bmw implements Drivable {
  
  }
  
  @Component
  class Mercedes implements Drivable {
  
  }
  
  class Driver {
      private Drivable drivable;
  
      public Driver(Drivable drivable) {
          this.drivable = drivable;
      }
  }
  </code></pre>
  <p>And Spring Java Config</p>
  <pre><code>@Configuration
  @ComponentScan
  class CarConfig {
      @Bean
      @Qualifier(&quot;mercedes&quot;)//the code won't work
      public Driver getDriver(Drivable drivable) {
          return new Driver(drivable);
      }
  
      @Bean//I've added the bean
      public Drivable getMercedes() {
          return new Mercedes();
      }
  }
  </code></pre>
  <p>Can I use <code>@Qualifier</code> annotation with <code>@Bean</code> annotation if I want to specify type of object that should pass to method?  I can't find in Spring doc how I can solve the problem. Thx.</p>