Annotation Interface RsqlSpec
Marks a controller method parameter to be automatically resolved as a
Specification from an RSQL query string.
When applied to a method parameter, the annotated parameter will receive a Specification
built from the RSQL query provided in the HTTP request. The RSQL query is parsed,
validated against the target entity's RsqlFilterable annotations, and converted
into a Spring Data JPA Specification. Entity
metadata and alias mappings are sourced from WebQuery on the same controller method.
Example usage in a controller:
@GetMapping("/users")
@WebQuery(entityClass = User.class)
public List<User> search(
@RsqlSpec(paramName = "filter") Specification<User> spec
) {
return userRepository.findAll(spec);
}
If the query parameter is not present in the request, the Specification
will be equivalent to Specification.unrestricted(), returning all results.
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
paramName
String paramNameThe name of the query parameter that contains the RSQL string. Defaults to "filter".- Returns:
- the HTTP request query parameter name
- Default:
"filter"
-