Spring Boot Jpa如何封装一个BaseDao?
怎么把springboot的jpa封装一个basedao,
public interface BaseDao<T, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T>
其他的dao,都继承这个BaseDao就可以呢?
而不是每一个Dao都继承JpaRepository这个。
比如:
public interface DepartmentDao extends JpaRepository<Department, Integer>, JpaSpecificationExecutor<Department>
这样正确
但是,如果public interface DepartmentDao extends BaseDao<Department, Integer>
就错误。
错误如下:
Error creating bean with name 'departmentDao': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property createObject found for type Department!
应该怎么写呢?
请大神帮忙!