__
/ _\_ __ ___ ___ /\/\ __ _ _ __ _ __ ___ _ __
\ \| '_ \ / _ \/ __|/ \ / _` | '_ \| '_ \ / _ \ '__|
_\ \ |_) | __/ (__/ /\/\ \ (_| | |_) | |_) | __/ |
\__/ .__/ \___|\___\/ \/\__,_| .__/| .__/ \___|_|
|_| |_| |_|
Specification binding API for Spring Data JPA
What is Specification Mapper?
Specification Mapper is a tool that facilitates the construction of Specifications. It reads the fields of a POJO and, through simple and memorable annotations, converts the values of these fields into Specifications. Specification Mapper also provides many extension points, allowing you to easily expand and implement your own logic.
In the Clean Architecture, Specification Mapper provides a convenient way to convert and use any POJO in any layer. For example, in the infrastructure layer, Specification mapper can be used to convert domain objects into specifications. By using Specification Mapper, we can effectively manage dependencies between layers and achieve a clear and structured code architecture, enhancing code readability and maintainability.
Dynamic Query Generation
Automatically reads object fields and generates query conditions based on annotations, saving time and reducing the need for custom query code.
Integration with Spring Boot
With specification-mapper-starter, integration with Spring Boot requires no configuration, making it easy to set up and start using in Spring applications.
Flexible Skipping Strategy
Fields that are null
, empty, or lack annotations are ignored during conversion, allowing for efficient query condition management and reducing redundant criteria.
Customizable Annotations
Define specific query behavior with various @Spec
annotations like Equals, Like, and Between, making it highly adaptable to different querying needs.
Support for Custom Specifications
Enables extending @Spec
with custom implementations, allowing users to handle complex queries, such as subqueries, tailored to specific application requirements.
Combining Specifications
With @And
and @Or
annotations, specifications can be combined at both class and field levels, offering precise control over query logic for complex filtering needs.