title: Spring Data Failed to create query for method
body: <p>Error:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'appController': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jenkinsService': Unsatisfied dependency expressed through field 'repo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jenkinsRepo': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.example.crud.JenkinsRepo.findByrun_id(java.lang.String)! No property run found for type Jenkins!</p>
  </blockquote>
  
  <p>This is the Jenkins class to define table entity:</p>
  
  <pre><code>package com.example.crud;
  
  import javax.persistence.*;
  
  @Entity
  @Table(name="test_case_failure")
  public class Jenkins {
  
      @Id
      @Column(name = "failure_id")
      private int failure_id;
  
      @Column(name="test_case_name")
      private String test_case_name;
      @Column(name="expected_value")
      private String expected_value;
      @Column(name="error_name")
      private String error_name;
      @Column(name="auto_error_type")
      private String auto_error_type;
      @Column(name="run_id")
      private String run_id;
  
      public Jenkins() {
      }
  
      public int getFailure_id() {
          return failure_id;
      }
  
      public void setFailure_id(int failure_id) {
          this.failure_id = failure_id;
      }
  
      public String getTest_case_name() {
          return test_case_name;
      }
  
      public void setTest_case_name(String test_case_name) {
          this.test_case_name = test_case_name;
      }
  
      public String getExpected_value() {
          return expected_value;
      }
  
      public void setExpected_value(String expected_value) {
          this.expected_value = expected_value;
      }
  
      public String getError_name() {
          return error_name;
      }
  
      public void setError_name(String error_name) {
          this.error_name = error_name;
      }
  
      public String getAuto_error_type() {
          return auto_error_type;
      }
  
      public void setAuto_error_type(String auto_error_type) {
          this.auto_error_type = auto_error_type;
      }
  
      public String getRun_id() {
          return run_id;
      }
  
      public void setRun_id(String run_id) {
          this.run_id = run_id;
      }
  
  }
  </code></pre>
  
  <p>Controller class:</p>
  
  <pre><code>package com.example.crud;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  import java.util.List;
  
  @Controller
  public class appController {
  
      @Autowired
      private jenkinsService service;
  
      @RequestMapping("/")
      public String viewHomePage(Model model) {
          List&lt;Jenkins&gt; listProducts = service.getbyrun_id();
          model.addAttribute("TestsReports", listProducts);
  
          return "index";
      }
  
  }
  </code></pre>
  
  <p>Repository class:</p>
  
  <pre><code>package com.example.crud;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  import java.util.List;
  
  @Repository
  public interface JenkinsRepo extends JpaRepository&lt;Jenkins, Integer&gt; {
      List&lt;Jenkins&gt; findByrun_id(String run_id);
  }
  </code></pre>
  
  <p>Service class:</p>
  
  <pre><code>package com.example.crud;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  import java.util.List;
  
  @Service
  public class jenkinsService {
  
      @Autowired
      private JenkinsRepo repo;
  
      List&lt;Jenkins&gt; getbyrun_id() {
          return repo.findByrun_id("test");
      }
  
  }
  </code></pre>