Skip to content

Rapter1990/jpaspecification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot JPA Specification Example

Main Information

📖 Information

  • This Spring Boot application showcases the integration of Spring Data JPA Specifications for dynamic and fine-grained querying of employee records.
  • The implemented features include processes such as listing, filtering, and retrieving employee records based on various criteria using specifications.
  • Specifications are employed to construct flexible queries, enabling the application to efficiently retrieve specific sets of employees based on dynamic conditions.

Explore Rest APIs

Method Url Description Request Body
GET /api/v1/employees/getEmployees Get Employees ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By FirstName ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Keyword ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Department Name ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Birthday At ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Birthday After ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Birthday Before ListEmployeeRequest Info
GET /api/v1/employees/getEmployees Get Employees By Birthday Between ListEmployeeRequest Info

Request with Request Body

    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter":{}
    }
    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter":{
            "firstName":"Stormy"
        }
    }
    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "keyword": "Mitchell"
        }
    }
    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "firstName": "Domonique",
            "departmentName": "Public Safety"
        }
    }
    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "birthdayDate": {
            "birthdayDateFirst": "1984-10-04",
                "dateComparison": "AT"
            }
        }
    }

    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "birthdayDate": {
            "birthdayDateFirst": "1994-01-13",
                "dateComparison": "AFTER"
            }
        }
    }

    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "birthdayDate": {
            "birthdayDateFirst": "1994-01-13",
                "dateComparison": "BEFORE"
            }
        }
    }

    
    http://localhost:8080/api/v1/employees/getEmployees
    
    {
        "filter": {
            "birthdayDate": {
              "birthdayDateFirst": "1981-07-28",
              "birthdayDateSecond": "1982-07-20",
                "dateComparison": "BETWEEN"
            }
        }
    }

    

Technologies


  • Java 17
  • Spring Boot 3.0
  • Restful API
  • Lombok
  • Maven
  • Postman
  • Faker
  • Spring Boot Devtools

Maven Run

To build and run the application with Maven, please follow the directions shown below;

$ cd jpaspecification
$ mvn clean install
$ mvn spring-boot:run

Screenshots

Screenshots

Click here to show the screenshots of project

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Contributors