Accepting a Spring Data REST URI in custom controller

后端 未结 2 547
时光说笑
时光说笑 2021-02-05 08:08

I have a Spring Data Rest webmvc application that I\'d like to add some custom functionality to for batch operations.

I\'ve created a controller, and blended it into the

2条回答
  •  萌比男神i
    2021-02-05 08:39

    I am posting an answer based on my last comment.

    Apparently the logic you require -- autoconverting URI from @RequestParam to a repository-managed entity -- is implemented in a few private methods of RepositorySearchController (see executeQueryMethod and prepareUris), so there's no easy way to get it in custom controllers.

    You can try creating your own argument resolver with Spring HATEOAS. Look into how PersistentEntityResourceHandlerMethodArgumentResolver resolver is implemented. It resolved an entity based on its @BackendId.

提交回复
热议问题