Multiple Repositories for the Same Entity in Spring Data Rest

后端 未结 4 808
执念已碎
执念已碎 2020-12-05 17:55

Is it possible to publish two different repositories for the same JPA entity with Spring Data Rest? I gave the two repositories different paths and rel-names, but only one o

4条回答
  •  臣服心动
    2020-12-05 18:22

    The terrible part is not only that you can only have 1 spring data rest repository (@RepositoryRestResource) per Entity but also that if you have a regular JPA @Repository (like CrudRepository or PagingAndSorting) it will also interact with the spring data rest one (as the key in the map is the Entity itself). Lost quite a few hours debugging random load of one or the other. I guess that if this is a hard limitation of spring data rest at least an Exception could be thrown if the key of the map is already there when trying to override the value.

提交回复
热议问题