findAll işlemi için repository ismi yazılır. 
Örnek
Şöyle yaparız
  
http://localhost:8080/peopleÖrnek
Elimizde şöyle bir kod olsun
@Entity
@Table(name="tb_Student")
public class Student {
  ...
}
public interface StudentRepo extends JpaRepository<Student, Integer>{
}İstek gönderelim. URL'de repository'nin çoğul hali kullanılıyorhttp://localhost:8080/students
{
  "_embedded" : {
    "students" : [ {
      "firstName" : "Avans",
      "lastName" : "MA",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/students/1"
        },
        "student" : {
          "href" : "http://localhost:8080/api/students/1"
        }
      }
    }, {
      "firstName" : "Abhi",
      "lastName" : "WE",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/students/2"
        },
        "student" : {
          "href" : "http://localhost:8080/api/students/2"
        }
      }
    }, 
    ...
   ]
}
 
Hiç yorum yok:
Yorum Gönder