看《spring实战5》spring data给的连接数据库的接口是CrudRepository,而公司项目中我我们通常用JpaRepository,看一下源码
Repository:该接口是 Spring Data 的一个核心接口,它不提供任何方法,开发者需要在自己定义的接口中声明需要的方法
借鉴:https://blog.csdn.net/m0_37402140/article/details/78880125
再看JpaRepository接口
JpaRepository又继承了了QueryByExampleExecutor和PagingAndSortingRepository两个接口
QueryByExampleExecutor接口的定义,支持Example动态查询,多条件查询
PagingAndSortingRepository集成了CrudRepository接口
总结吧,就是JpaRepository继承了CrudRepository的功能,且又支持Example方法的多功能查询!