title: Could not autowire field
body: <p>I'm using <code>Hibernate 4</code> + <code>Spring MVC 4</code> and when i start <code>Apache Tomcat Server 8</code> I got this error :</p>
  
  <pre><code>Error creating bean with name 'welcome': Injection of autowired dependencies failed;
  Could not autowire field: private dao.IRegion controller.welcome.regionI;
  No qualifying bean of type [dao.IRegion] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  
  <p>here's my Hibernate Configuration which contain <code>&lt;property name="packagesToScan" value="dao" /&gt;</code> :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
     &lt;context:property-placeholder location="persistence-mysql.properties" /&gt;
  
     &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
        &lt;property name="dataSource" ref="dataSource" /&gt;
        &lt;property name="packagesToScan" value="dao" /&gt;
        &lt;property name="hibernateProperties"&gt;
           &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
           &lt;/props&gt;
        &lt;/property&gt;
     &lt;/bean&gt;
  
  &lt;!--    &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; --&gt;
     &lt;bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp2.BasicDataSource"&gt;
        &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt;
        &lt;property name="url" value="${jdbc.url}" /&gt;
        &lt;property name="username" value="${jdbc.user}" /&gt;
        &lt;property name="password" value="${jdbc.pass}" /&gt;
     &lt;/bean&gt;
  
     &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
     &lt;/bean&gt;
  
     &lt;bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>dao</strong> is the package where i put my dao and interfaces.  </p>
  
  <p>My region Interface <code>dao.IRegion</code> :</p>
  
  <pre><code>public interface IRegion&lt;T extends Serializable&gt; {
  
      List&lt;T&gt; findAll();
  
  }
  </code></pre>
  
  <p>my Region DAO  <code>dao.RegionDAO</code></p>
  
  <pre><code>@Repository
  public class RegionDAO  implements IRegion &lt; Region &gt; {
  
      @Autowired
      private SessionFactory sessionFactory;
  
      @Override
      public List&lt;Region&gt; findAll() {
  
          return  sessionFactory.getCurrentSession().createQuery("from Region").list();
      }
  
  }
  </code></pre>
  
  <p>My Controller</p>
  
  <pre><code>@Controller
  public class welcome {
  
      @Autowired
      private IRegion&lt;Region&gt; regionI;
          ....
  
  }
  </code></pre>
  
  <p>My servlet dispatcher</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:mvc="http://www.springframework.org/schema/mvc"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
                             http://www.springframework.org/schema/beans/spring-beans.xsd
                             http://www.springframework.org/schema/mvc
                             http://www.springframework.org/schema/mvc/spring-mvc.xsd
                             http://www.springframework.org/schema/context
                             http://www.springframework.org/schema/context/spring-context.xsd"&gt;
      &lt;mvc:default-servlet-handler /&gt;
      &lt;context:component-scan base-package="controller"/&gt;
      &lt;mvc:annotation-driven /&gt;
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;  
  
      &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/pages/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>