title: How to solve "spring crudrepository bean not found" in Spring boot?
body: <p>I'm relatively new to Spring and have a working project on work machine but am trying to setup the same project on my personal laptop and am having the following issue when starting up my project:</p>
  
  <pre><code>Description:
  Field productRepository in prs.web.ProductController required a bean of type 'prs.domain.product.ProductRepository' that could not be found.
  Action:
  Consider defining a bean of type 'prs.domain.product.ProductRepository' in your configuration.
  </code></pre>
  
  <p>I have been through many suggested fixes in stack that have not worked.  This same project works fine on other machines, including peers that have pulled my project, so I believe its something in my configuration.  I'm using the following:
  IDE:  Spring Tool Suite
  Version: 3.9.2.RELEASE
  Build Id: 201712210947
  Platform: Eclipse Oxygen.2 (4.7.2)
  OS:  Windows 10</p>
  
  <p>Here is my code:
  POM Dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p></p>
  
  <p>App class - PRSWebApplication:</p>
  
  <pre><code>package prs;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class PRSWebApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(PRSWebApplication.class, args);
      }
  }
  </code></pre>
  
  <p>Entity Class - Product.java</p>
  
  <pre><code>package prs.domain.product;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  @Entity
  public class Product {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private int id;
      private int vendorID;
      private String partNumber;
      private String name;
      private double price;
      private String unit;
      private String photoPath;
  
      public Product() {
          id = 0;
          vendorID = 0;
          partNumber = "";
          name = "";
          price = 0.0;
          unit = "";
          photoPath = "";
      }
  </code></pre>
  
  <p>Repository: ProductRepository.java</p>
  
  <pre><code>package prs.domain.product;
  
  import java.util.List;
  
  import org.springframework.data.repository.CrudRepository;
  
  public interface ProductRepository extends CrudRepository&lt;Product, Integer&gt;{
  
      List&lt;Product&gt; findAllByVendorID(int id);
      List&lt;Product&gt; findAllByVendorIDNot(int id);
  }
  </code></pre>
  
  <p>Controller - ProductController.java</p>
  
  <pre><code>package prs.web;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  import prs.domain.product.Product;
  import prs.domain.product.ProductRepository;
  import prs.util.PRSMaintenanceReturn;
  
  @Controller
  @RequestMapping(path="/Products")
  public class ProductController extends BaseController {
      @Autowired
      private ProductRepository productRepository;
  
      @GetMapping(path="/List")
      public @ResponseBody Iterable&lt;Product&gt; getAllProducts() {
          // This returns a JSON or XML with the users
          return productRepository.findAll();
      }
  </code></pre>
  
  <p>I've seen various fixes that state something about moving my app to a package, but its already in the 'prs' package.  I've also tried various pom file changes and have re-installed Eclipse (various versions but am currently using the STS version noted above).</p>
  
  <p>Any help is greatly appreciated!</p>