title: Field repository in my service required a bean that could not be found
body: <p>Here is the error </p>
  
  <pre><code>Description:
  
  Field userRepository in com.yaqari.service.UserService required a bean of type 'com.yaqari.repository.UserRepository' that could not be found.
  
   The injection point has the following annotations:
      - @org.springframework.beans.factory.annotation.Autowired(required=true)
  
  
   Action:
  
   Consider defining a bean of type 'com.yaqari.repository.UserRepository' in your configuration.
  </code></pre>
  
  <p>Here is my project structure :</p>
  
  <pre><code>pom.xml
  src
  ├───main
  │   ├───java
  │   │   └───com
  │   │       └───yaqari
  │   │           │   YaqariApplication.java
  │   │           │   DataLoader.java
  │   │           ├───controller
  │   │           │       UserController.java
  │   │           ├───model
  │   │           │       User.java
  │   │           ├───repository
  │   │           │       UserRepository.java
  │   │           └───service
  │   │                   UserService.java
  │   └───resources
  │
  └───test
      └───java
  </code></pre>
  
  <p>Controller is a @RestController :</p>
  
  <pre><code>@RestController
  public class UserController {
  
      @Autowired
      private UserService userService;
  
      @GetMapping(value = "/users")
      public List&lt;User&gt; list() {
          return userService.findAll();
      }
  }
  </code></pre>
  
  <p>Model is @Entity :</p>
  
  <pre><code>@Entity
  public class User {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long user_id;
  
      protected User() {
      }
  
  }
  </code></pre>
  
  <p>Repository is a @Repository that extends CrudRepository</p>
  
  <pre><code>@Repository
  public interface UserRepository extends CrudRepository&lt;User, Long&gt; {
  }
  </code></pre>
  
  <p>Service is a @Service</p>
  
  <pre><code>@Service
  public class UserService {
  
      @Autowired         // &lt;- here seems to be the issue
      private UserRepository userRepository;
  
      public List&lt;User&gt; findAll() {
          Iterable&lt;User&gt; users = userRepository.findAll();
          ArrayList&lt;User&gt; userList = new ArrayList&lt;&gt;();
          users.forEach(e -&gt; userList.add(e));
  
          return userList;
      }
  }
  </code></pre>
  
  <p>Edit :
  I'm working with a sringboot application</p>
  
  <pre><code>@SpringBootApplication
  public class YaqariApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(YaqariApplication.class, args);
      }
  }
  </code></pre>