title: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'userJpaRepository'
body: <p>I have the following error when I try to acces into main page</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'userJpaRepository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'net.codejava.spring.repository.UserRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=userJpaRepository)}
  </code></pre>
  
  <p>In my UserController I have the following code</p>
  
  <pre><code>@Controller
  public class UserController {
  
      private UserService employeeServiceImpl;
  
      @RequestMapping("/")
      public String employee() {
          this.employeeServiceImpl.listAlUsers();
          return "employee";
      }
  
      @Autowired(required = true)
      public void setEmployeeService(UserService employeeServiceImpl) {
          this.employeeServiceImpl = employeeServiceImpl;
      }
  
  }
  </code></pre>
  
  <p>My UserService</p>
  
  <pre><code>public interface UserService {
      public abstract List&lt;User&gt; listAlUsers();
      public abstract User addUser(User user);
      public abstract int removeUser(int id);
      public abstract User updateUser(User user);
  }
  </code></pre>
  
  <p>My UserServiceImpl</p>
  
  <pre><code>@Service("userService")
  public class UserServiceImpl implements UserService {
  
      @Autowired
      @Qualifier("userJpaRepository")
      private UserRepository userJpaRepository;
  
      @Override
      public List&lt;User&gt; listAlUsers() {
          return userJpaRepository.findAll();
      }
  
      @Override
      public User addUser(User user) {
          return userJpaRepository.save(user);
      }
  
      @Override
      public int removeUser(int id) {
          userJpaRepository.delete(id);
          return 0;
      }
  
      @Override
      public User updateUser(User user) {
          return userJpaRepository.save(user);
      }
  }
  </code></pre>
  
  <p>My JpaRepository</p>
  
  <pre><code>@Repository("userJpaRepository")
  public interface UserRepository extends JpaRepository&lt;User,Serializable&gt; {
  
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
  
      &lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/root-context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;!-- Processes application requests --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>My servlet-context </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:mvc="http://www.springframework.org/schema/mvc"
         xmlns:jpa="http://www.springframework.org/schema/data/jpa"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-4.0.xsd"&gt;
  
      &lt;!--The &lt;context:component-scan...&gt; tag will be use to activate Spring MVC annotation scanning capability which allows to make use of annotations like @Controller and @RequestMapping etc.--&gt;
      &lt;!--Step 1 : HandlerMapping --&gt;
      &lt;context:component-scan base-package="com.loiane.controller" /&gt;
  
      &lt;!--JPA Repository--&gt;
  
      &lt;jpa:repositories base-package="com.loiane.repository.EmployeeJpaRepository"/&gt;
  
      &lt;mvc:annotation-driven /&gt;
  
      &lt;!--Step 3 : View Resolver--&gt;
  
      &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix"&gt;
              &lt;value&gt;/WEB-INF/views/&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="suffix"&gt;
              &lt;value&gt;.jsp&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;!--Bundles--&gt;
      &lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
          &lt;property name="basename"&gt;
              &lt;value&gt;messages&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!--Declaramos el interceptor para permitir el cambio de idioa en tiempo de ejecucion--&gt;
      &lt;mvc:interceptors&gt;
          &lt;mvc:interceptor&gt;
              &lt;mvc:mapping path="/**" /&gt;
              &lt;bean id="localeChangeInterceptor"
                    class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
                  &lt;property name="paramName" value="lang" /&gt;
              &lt;/bean&gt;
          &lt;/mvc:interceptor&gt;
      &lt;/mvc:interceptors&gt;
  
      &lt;!--Si el idioma no existe cargamos el en--&gt;
  
      &lt;bean id="localeResolver"
            class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;
          &lt;property name="cookieName" value="lang" /&gt;
          &lt;property name="defaultLocale" value="en" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The root-context is empty.</p>
  
  <p>I don't know where is the possible cause of error I try to find differents options , but If I use the DAO pattern I receive the same error , so I would to know which is to problem to try to solve it.</p>
  
  <p>The configuration of the project is with xml but I think there is not important to solve this situation.</p>
  
  <p>Regards !</p>