Spring Data REST takes an opinionated approach to exposing Spring Data repositories via REST endpoints, covering the 80-90% use case with a minimum of code and fuss. But did you know that it provides a no-lifting-required mechanism for exposing query methods you define on those repositories as well?
Let’s say you create a method like this:
Referencing that bit of functionality directly is simple, just append /search/
For more information, click here to view the Spring Data REST docs. Keep coding/keep sharing!
Find this useful? Click here to follow me on Twitter and be notified of future posts! And don’t forget to share this Quick Tip via the button(s) below. Thanks!
- T4SD (Tips 4 Spring Devs): How to get Spring Boot REST endpoints to speak XML
- Spring Boot for IoT Developers: Getting Started
- Getting up & running quickly with Spring Cloud Sleuth
- T4SD (Tips 4 Spring Devs): Request header filtering in @RequestMapping
- T4SD (Tips 4 Spring Devs): Spring Boot Actuator /actuator endpoint