title: Spring - No qualifying bean of type
body: <p>just started learning Spring. 
  Trying to learn JPA by creating a person class, <code>PersonRepository</code>, <code>PersonDAO</code> and <code>main</code>.
  I've already looked on StackOverflow for answers but I think I did everything all right...
  This is the exception:</p>
  
  <blockquote>
    <p>Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'beans.PersonDAO' available
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:353)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:340)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1090)
        at com.example.SrpingDataJPA.main.main(main.java:15)</p>
  </blockquote>
  
  <p>This is my classes:</p>
  
  <p>Person.class:
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package beans;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="workers")
  public class Person {
  
   @Id
   @Column(name="name")
   private String name;
   
   public Person(String name) {
    this.name = name;
   }
  
   public String getName() {
    return name;
   }
  
   public void setName(String name) {
    this.name = name;
   }
  
   @Override
   public String toString() {
    return "Person [name=" + name + "]";
   }
   
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>PersonRepo.class:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package beans;
  
  import java.util.List;
  
  import org.springframework.data.repository.CrudRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface PersonRepo extends CrudRepository&lt;Person, String&gt;{
   
    List&lt;Person&gt; findByName(String name);
   
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>PersonDAO.class:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package beans;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public class PersonDAO {
   
   @Autowired
   private PersonRepo personRepo;
   
   public PersonDAO() {
   }
   
   public void createPerson(Person person){
    personRepo.save(person);
   }
   
   public List&lt;Person&gt; find(String name){
    return personRepo.findByName(name);
   }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>main.class:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.example.SrpingDataJPA;
  
  import javax.transaction.Transactional;
  
  import org.jboss.jandex.Main;
  import org.springframework.boot.SpringApplication;
  import org.springframework.context.ApplicationContext;
  
  import beans.PersonDAO;
  
  @Transactional
  public class main {
   public static void main(String[] args) {
    ApplicationContext context = SpringApplication.run(Main.class, args);
    PersonDAO personDAO = context.getBean(PersonDAO.class);
    
    System.out.println(personDAO .find("daniel"));
   }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any help guys?</p>