import org.springframework.data.repository.NoRepositoryBean;import org.springframework.data.repository.Repository;import java.io.Serializable;import java.util.Optional;@NoRepositoryBeanpublic interface BaseRepository<T, ID extends Serializable> extends Repository<T, ID> { Optional<T> deleteById(ID id);}
Annotate the created interface with the @NoRepositoryBean annotation. This ensures that Spring Data JPA won’t try to create an implementation for the BaseRepository interface.