title: No qualifying bean of type found for dependency
body: <p>I´m tri to run a JUnit Test um my spring boot project i bilded like this:</p>
  
  <pre><code>import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.query.Param;
  import org.springframework.stereotype.Repository;
  
  import com.br.suppcomm.ocp.entity.Login;
  
  
  public interface LoginDao extends JpaRepository&lt;Login, Long&gt;{
  ...
  }
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  import com.br.suppcomm.ocp.dao.CompanyDAO;
  import com.br.suppcomm.ocp.dao.LoginDao;
  import com.br.suppcomm.ocp.entity.Login;
  
  
  
  @Service
  public class LoginService  {
  
      @Autowired LoginDao loginDao; 
  
  
      @Autowired CompanyDAO companyDao;
  
  
      public void save(Login login) {
  
          loginDao.save(login);
  
  
      }
  
  
      public void delete(Login login) {
           loginDao.delete(login);
      }
  
  
      public Login findById(Login login) {
          return loginDao.findOne(login.getLoginId());
      }
  
  
      public Login findByEmail(Login login) {
          return loginDao.findByEmail(login.getEmail());
      }
  
  
      public Login FindByLogin(Login login) {
          return loginDao.FindByLogin(login);
      }
  
  
      public List&lt;Login&gt; getAll() {
  
          return loginDao.findAll();
      }
  
  
      public Login getUserAccessLoginPass(String login, String password) {
          return loginDao.getUserAccessLoginPass(login, password);
      }
  
  
      public void update(Login login) {
           loginDao.save(login);
  
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Test:</p>
  
  <pre><code>package com.example;
  
  
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.test.context.SpringBootTest;
  import org.springframework.test.context.junit4.SpringRunner;
  
  import com.br.suppcomm.ocp.service.LoginService;
  
  
  @RunWith(SpringRunner.class)
  
  @SpringBootTest
  public class OcpJpaApplicationTests {
  
      @Autowired LoginService loginService;
  
      @Test
      public void contextLoads() {
  
  
      }    
  
  }
  </code></pre>
  
  <p>When I ran this code did show me the folow error.</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:        
  </code></pre>
  
  <blockquote>
    <p>Error creating bean with name 'loginService': Unsatisfied dependency
    expressed through field 'loginDao': No qualifying bean of type </p>
    
    <p>[com.br.suppcomm.ocp.dao.LoginDao] found for dependency 
    [com.br.suppcomm.ocp.dao.LoginDao]: expected at least 1 bean which
    qualifies as  autowire candidate for this dependency. Dependency
    annotations: 
    {@org.springframework.beans.factory.annotation.Autowired(required=true)};
    nested  exception is
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No 
    qualifying bean of type [com.br.suppcomm.ocp.dao.LoginDao] found for
    dependency  [com.br.suppcomm.ocp.dao.LoginDao]: expected at least 1
    bean which qualifies as  autowire candidate for this dependency.
    Dependency annotations: 
    {@org.springframework.beans.factory.annotation.Autowired(required=true)}</p>
  </blockquote>
  
  <p>I dont know what happened!! Please.</p>