Spring Data REST: Override repository method on the controller

后端 未结 4 810
暖寄归人
暖寄归人 2020-12-05 10:32

I have the following REST repository, whose implementation is generated at runtime by Spring.

@RepositoryRestResource
public interface FooRepository extends          


        
4条回答
  •  伪装坚强ぢ
    2020-12-05 10:47

    Just an update that I found that saved my life. As said brilliantly by @mathias-dpunkt in this answer https://stackoverflow.com/a/34518166/2836627

    Most importantly the RepositoryRestController is aware of the spring data rest base path and will be served under this base path.

    So if your base path is "/api" and you are using @RepositoryRestController

    you have to ommit "/api" from @RequestMapping

提交回复
热议问题