diff --git a/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/EntityClassHelper.java b/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/EntityClassHelper.java index 33012502c1e81e..8d03d2ecb9add5 100644 --- a/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/EntityClassHelper.java +++ b/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/EntityClassHelper.java @@ -93,10 +93,6 @@ public boolean isListCrudRepository(String repositoryName) { || isRepositoryInstanceOf(JPA_REPOSITORY_INTERFACE, repositoryName); } - public boolean isJpaRepository(String repositoryName) { - return isRepositoryInstanceOf(JPA_REPOSITORY_INTERFACE, repositoryName); - } - public boolean isPagingAndSortingRepository(String repositoryName) { return isRepositoryInstanceOf(PAGING_AND_SORTING_REPOSITORY_INTERFACE, repositoryName) || isRepositoryInstanceOf(LIST_PAGING_AND_SORTING_REPOSITORY_INTERFACE, repositoryName) diff --git a/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/SpringDataRestProcessor.java b/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/SpringDataRestProcessor.java index 280aa259e52507..8c6122950b36b2 100644 --- a/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/SpringDataRestProcessor.java +++ b/extensions/spring-data-rest/deployment/src/main/java/io/quarkus/spring/data/rest/deployment/SpringDataRestProcessor.java @@ -94,13 +94,9 @@ void registerRepositories(CombinedIndexBuildItem indexBuildItem, Capabilities ca PAGING_AND_SORTING_REPOSITORY_INTERFACE, LIST_PAGING_AND_SORTING_REPOSITORY_INTERFACE, JPA_REPOSITORY_INTERFACE); - boolean paged = false; - if (entityClassHelper.containsPagedRepository(repositoriesToImplement)) { - paged = true; - } implementResources(capabilities, implementationsProducer, restDataResourceProducer, resourcePropertiesProducer, unremovableBeansProducer, new RepositoryMethodsImplementor(index, entityClassHelper), - new RepositoryPropertiesProvider(index, paged), + index, repositoriesToImplement); } @@ -114,11 +110,18 @@ private void implementResources(Capabilities capabilities, BuildProducer resourcePropertiesProducer, BuildProducer unremovableBeansProducer, ResourceMethodsImplementor methodsImplementor, - ResourcePropertiesProvider propertiesProvider, + IndexView index, + // ResourcePropertiesProvider propertiesProvider, List repositoriesToImplement) { ClassOutput classOutput = new GeneratedBeanGizmoAdaptor(implementationsProducer); ResourceImplementor resourceImplementor = new ResourceImplementor(methodsImplementor); + EntityClassHelper entityClassHelper = new EntityClassHelper(index); for (ClassInfo classInfo : repositoriesToImplement) { + boolean paged = false; + if (entityClassHelper.isPagingAndSortingRepository(classInfo.name().toString())) { + paged = true; + } + ResourcePropertiesProvider propertiesProvider = new RepositoryPropertiesProvider(index, paged); List generics = getGenericTypes(classInfo); String repositoryName = classInfo.name().toString(); String entityType = generics.get(0).toString(); diff --git a/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/BooksRepository.java b/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/BooksRepository.java index b6a6f2df5d2906..a7c86d4fc6dedf 100644 --- a/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/BooksRepository.java +++ b/integration-tests/spring-data-rest/src/main/java/io/quarkus/it/spring/data/rest/BooksRepository.java @@ -1,6 +1,7 @@ package io.quarkus.it.spring.data.rest; +import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; -public interface BooksRepository extends PagingAndSortingRepository { +public interface BooksRepository extends PagingAndSortingRepository, CrudRepository { }