diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java index b71461a11..60de8e905 100644 --- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java +++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappings.java @@ -61,14 +61,12 @@ public RepositoryResourceMappings(Repositories repositories, PersistentEntities this.repositories = repositories; this.configuration = configuration; - this.populateCache(entities, configuration); + this.populateCache(repositories, configuration); } - private void populateCache(PersistentEntities entities, RepositoryRestConfiguration configuration) { + private void populateCache(Repositories repositories, RepositoryRestConfiguration configuration) { - for (PersistentEntity> entity : entities) { - - Class type = entity.getType(); + for (Class type : repositories) { if (!repositories.hasRepositoryFor(type)) { continue; @@ -76,6 +74,7 @@ private void populateCache(PersistentEntities entities, RepositoryRestConfigurat RepositoryInformation repositoryInformation = repositories.getRequiredRepositoryInformation(type); Class repositoryInterface = repositoryInformation.getRepositoryInterface(); + PersistentEntity entity = repositories.getPersistentEntity(type); RepositoryDetectionStrategy strategy = configuration.getRepositoryDetectionStrategy(); LinkRelationProvider provider = configuration.getLinkRelationProvider();