I am new to Spring Boot. I am following this tutorial:
https://spring.io/guides/tutorials/rest/
In this tutorial, there is an interface declaration like this:
package payroll;
import org.springframework.data.jpa.repository.JpaRepository;
interface EmployeeRepository extends JpaRepository<Employee, Long> {
}
First question; Why do we declare this interface? In the code followed during tutorial, if I put JpaRepository<Employee, Long> instead of EmployeeRepository, everything works as before. Why would I use EmployeRepository interface, while original interface is there?
Second question; how is the interface is implemented and created an object of this implementation automatically by Spring Boot? What is the magic behind?