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