3

Hello stack overflow

I am creating a demo application for myself using spring-data-jpa and spring-data-rest. I have two repository interfaces:

interface PersonRepository : PagingAndSortingRepository<Person, Long>

@RepositoryRestResource(path = "people", collectionResourceRel = "people", exported = true)
interface PeopleRepository : PagingAndSortingRepository<Person, Long>

I changed the repositoryDetectionStrategy to RepositoryDetectionStrategies.ANNOTATED.

I created for the personRepository a self-made RestController for the peopleRepository I want it to be created by spring and exposed at localhost:8080/ by hateos

Problem

  • Just randomly the peopleRepository is exposed(not working at all).

After debugging I can say for sure that RepositoryRestMvcConfiguration's Bean Repositories is the reason for the problem.

org.springframework.data.repository.support.Repositories's method populateRepositoryFactoryInformation gets over all Repositories since I have two for the same Class the inner map.put overrides my desired behavior depending which bean comes first.

So is this a bug or spring does not support several Repository-Interfaces with spring-data-rest or did I misconfigure my setup?

Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32
DoZi
  • 31
  • 3

1 Answers1

0

Sadly, it seems that SpringData does not handle well this kind of scenario (I was using spring-boot 1.5.8, when I found the same problem as you... I tried to upgrade my spring version to see if this was fixed, but I begin to get other compilation/deployments issues. so I quit that idea...)

You can get more info in these links:

Carlitos Way
  • 3,279
  • 20
  • 30