У меня есть базовый класс репозитория, как определено ниже.
@NoRepositoryBean
public interface BaseRepository<T, ID extends Serializable> extends JpaRepository<T, ID> {
}
public class BaseRepositoryImpl<T, ID extends Serializable>
extends SimpleJpaRepository<T, ID> implements BaseRepository<T, ID> {
public BaseRepositoryImpl(JpaEntityInformation<T, ?> entityInfo, EntityManager entityMgr) {
super(entityInfo, entityMgr);
}
// ...
}
@Configuration
@EnableJpaRepositories(basePackages = "org.example",
repositoryBaseClass = BaseRepositoryImpl.class)
public class BaseConfig {
// additional JPA Configuration
}
Я определил класс бизнес-репозитория и метод запроса, как показано ниже.
@Repository
public interface CarRepository extends BaseRepository<Car, Long> {
@Query("SELECT c FROM Car c Where active = 1")
List<Car> findAllActiveCars();
}
У меня есть тестовый класс, который вызывает findAllActiveCars (). Я получаю ожидаемые результаты. Но этот метод запроса не вызывает ни один из методов в классе BaseRepository. Как настроить возвращаемые значения методов запроса?