在做項目時創(chuàng)建對象的功能會交給Spring去管理, 在掃描Reposytory層包時, 會掃描到BaseReposytory接口 ;
為了告訴JPA不要創(chuàng)建對應(yīng)接口的bean對象 就在類上加注解@NoRepositoryBean
這樣spring容器中就不會有BaseReposytory接口的bean對象
@NoRepositoryBean //告訴JPA不要創(chuàng)建對應(yīng)接口的bean對象 public interface BaseReposittory <T,ID extends Serializable> extends JpaRepository<T,ID>,JpaSpecificationExecutor<T> { }