Spring Boot JpaStreamer Example
๐ Information
- The purpose of the example is to handle with writing queries with the usage of JPASteamer library
- Here is the explanation of the example
- Load initial data about Person into h2 database through JavaFaker library
- Get person list or person object from the database with the usage of JPASteamer through collect, filter, range, equal, less than, starts with, between and so on
Explore Rest APIs
Method | Url | Description | Valid Path Variable | No Path Variable |
---|---|---|---|---|
GET | /persons/jpastreamer/all | Get All Person List | Info | |
GET | /persons/jpastreamer/{id} | Get Person By Id | Info | |
GET | /persons/jpastreamer/findByFirstCharacterOfFirstName/{character} | Get Person List By First Character of Firstname | Info | |
GET | /persons/jpastreamer/findByAge/{age} | Get Person List By Age | Info | |
GET | /persons/jpastreamer/findByLessThanAge/{age} | Get Person List By Age Less Than | Info | |
GET | /persons/jpastreamer/findByFirstCharacterOfFirstNameAndAge/{character}/{age} | Get Person List By First Character of Firstname and Age | Info | |
GET | /persons/jpastreamer/findByAgeRange/{age1}/{age2} | Get Person List By Age Range | Info | |
GET | /persons/jpastreamer/findMaximumAge | Get Person By Maximum Age | Info | |
GET | /persons/jpastreamer/findMinimumAge | Get Person By Minimum Age | Info | |
GET | /persons/jpastreamer/findByBirthdayRange/{startDate}/{endDate} | Get Person List By Birthday Range | Info |
Valid Path Variable
Get All Person List
http://localhost:8080/persons/jpastreamer/all
Get Person By Id
http://localhost:8080/persons/jpastreamer/1
Get Person List By First Character of Firstname
http://localhost:8080/persons/jpastreamer/findByFirstCharacterOfFirstName/K
Get Person List By Age
http://localhost:8080/persons/jpastreamer/findByAge/35
Get Person List By Age Less Than
http://localhost:8080/persons/jpastreamer/findByLessThanAge/60
Get Person List By First Character of Firstname and Age
http://localhost:8080/persons/jpastreamer/findByFirstCharacterOfFirstNameAndAge/J/45
Get Person List By Age Range
http://localhost:8080/persons/jpastreamer/findByAgeRange/10/60
Get Person List By Birthday Range
http://localhost:8080/persons/jpastreamer/findByBirthdayRange/1990-01-01/2023-07-13
No Path Variable
Get Person By Maximum Age
http://localhost:8080/persons/jpastreamer/findMaximumAge
Get Person By Minimum Age
http://localhost:8080/persons/jpastreamer/findMinimumAge
Technologies
- Java 17
- Spring Boot 3.0
- Restful API
- Lombok
- Maven
- Junit5
- Mockito
- Integration Tests
- Docker
- Docker Compose
- JpaSteamer
- JavaFaker
Prerequisites
- Maven or Docker
Docker Run
The application can be built and run by the Docker
engine. The Dockerfile
has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
$ cd jpastreamer
$ docker-compose up -d
If you change anything in the project and run it on Docker, you can also use this command shown below
$ cd jpastreamer
$ docker-compose up --build
Maven Run
To build and run the application with Maven
, please follow the directions shown below;
$ cd jpastreamer
$ mvn clean install
$ mvn spring-boot:run