Avatar ·

What is the difference between CrudRepository and JpaRepository in Spring Data JPA?

Hello everyone! I'm new to Spring and Spring Data JPA, and I keep getting confused by these two interfaces. When I look at examples online, I see some people using `CrudRepository` and others using `JpaRepository`. For example, here's how I usually declare my repositories: ```java public interface UserRepository extends CrudRepository { User findByEmail(String email); } ``` But I've also seen this variant: ```java public interface UserRepository extends JpaRepository { User findByEmail(String email); } ``` Both work, both provide methods like save(), findById(), findAll(), delete(), and so on. So what's the difference? Why did Spring create two different interfaces? Maybe JpaRepository is just a newer version of CrudRepository? Or do they have different