I'm using Spring Boot, when I want to extend SimpleJpaRepository
like this interface:
public interface BaseRepository<T, ID extends Serializable> extends JpaRepository<T, ID>{}
and this implementation:
public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements BaseRepository<T, ID>
{
private final EntityManager entityManager;
public BaseRepositoryImpl(Class<T> domainClass, EntityManager entityManager)
{
super(domainClass, entityManager);
this.entityManager = entityManager;
}
}
I got the following error:
Could not autowire. No beans of 'Class<T>' type found.
How can I resolve it?
JpaRepository
. Instead you should write an interface extendingJpaRepository
, and Spring will generate an implementing class automatically. You can find examples in Getting started with Spring Data JPA.