title: NoUniqueBeanDefinitionException: ... expected single matching bean but found 2:
body: <p>I have this super class:</p>
  
  <pre><code>@Component
  public class DAOBase {
  }
  </code></pre>
  
  <p>this other one class extends DAOBase </p>
  
  <pre><code>@Component
  public class VoceDAO extends DAOBase{       
  }
  </code></pre>
  
  <p>When I <code>AutoWired</code> the class DAOBase this way</p>
  
  <pre><code>@Service
  public class TransactionService {
      @Autowired
      private DAOBase dAOBase;
  }
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.jeansedizioni.dao.DAOBase] is defined: expected single matching bean but found 2: DAOBase,voceDAO
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:865)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
      ... 37 more
  </code></pre>
  
  <p>Reading some posts I found this solution:</p>
  
  <pre><code>@Component("DAOBaseBeanName")
  public class DAOBase {
  }
  </code></pre>
  
  <p>I want to be sure I perfectly understood the solution. 
  With <code>@Component("DAOBaseBeanName")</code> I give the class DAOBase the specific name "DAOBaseBeanName", with which the application can identify the class DAOBase, in order not to mix it up with other classes that extend DAOBase. Is it right?</p>
  
  <p>Thank you.</p>