public interface UserRepository
extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User>{
.........
}
其中JpaRepository<User, Integer>
的 User 就是该接口要查询的类名, Integer就是主键的类型
(也可以使用注解来替代以上方法)
@RepositoryDefinition(domainClass=User.class, idClass=Integer.class)
public interface UserRepository{
......
}
JpaSpecificationExecutor: 不属于Repository体系,实现一组 JPA Criteria 查询相关的方法 。