Search code examples
javaspring-bootmicronautmicronaut-data

What is micronaut's alternative for "JpaSpecificationExecutor"?


I want dynamic filter queries. Example

/api/users?name=xyz

/api/users?name=xyz&email=abc

With spring boot it was possible using JpaSpecificationExecutor, where I could pass custom "Specification". How to do this using micronaut-data?


Solution

  • You can use similar classes with Micronout Data's JPA specifications.

    Based on the same concept as Spring Data, when you need to create queries dynamically by composing JPA criteria then you can implement the JpaSpecificationExecutor interface which provides multiple methods that receive an instance of Specification which can be used in combination with existing repository interfaces.