https://github.com/andrei-punko/spring-boot-3-jsonb
Spring Boot 3 app with Postgres JSONB data type usage
https://github.com/andrei-punko/spring-boot-3-jsonb
hibernate-types java-jsonb jsonb postgres-jsonb postgresql postgresql-jsonb spring-boot spring-boot-3
Last synced: 29 days ago
JSON representation
Spring Boot 3 app with Postgres JSONB data type usage
- Host: GitHub
- URL: https://github.com/andrei-punko/spring-boot-3-jsonb
- Owner: andrei-punko
- License: mit
- Created: 2025-10-01T16:59:43.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-11-13T21:06:07.000Z (6 months ago)
- Last Synced: 2025-11-13T23:17:47.130Z (6 months ago)
- Topics: hibernate-types, java-jsonb, jsonb, postgres-jsonb, postgresql, postgresql-jsonb, spring-boot, spring-boot-3
- Language: Java
- Homepage:
- Size: 134 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Spring Boot 3 app with Postgres JSONB data type usage

[](https://github.com/andrei-punko/spring-boot-3-jsonb/actions/workflows/maven.yml)
[](https://github.com/andrei-punko/spring-boot-3-jsonb/actions/workflows/maven.yml)
Includes web-server on port 9080 with `/articles` endpoint exposed.
Supports CRUD set of operations and R operation with pagination.
## Prerequisites:
- Maven 3
- JDK 21
## Build an application:
mvn clean install
## Build Docker image with application inside:
docker build --no-cache ./ -t spring-boot-3-jsonb-app
## Start two Docker containers - with Postgres DB and application:
docker-compose up
## Link for quick check:
http://localhost:9080/articles
## Swagger documentation
http://localhost:9080/swagger-ui/index.html
## Postman requests
Placed in appropriate [folder](postman)
## Useful CURL commands
### New article addition:
```bash
curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
-d '{ "title": "Some tittle", "text": "Some text", "author": "Pushkin", "location": { "country": "BY", "city": "Minsk" } }' \
-X POST "http://localhost:9080/articles"
```
### Get existing article:
```bash
curl -i http://localhost:9080/articles/10
```
### Update existing article:
```bash
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Another tittle" }' \
-X PATCH http://localhost:9080/articles/2
```
### Search articles by an inner field of JSONB type:
```bash
curl -i 'http://localhost:9080/articles?country=RU'
```
```bash
curl -i 'http://localhost:9080/articles?country=RU&city=Moscow'
```
### Get list of articles with pagination support:
```bash
curl -i 'http://localhost:9080/articles/all?size=2&page=4&sort=title,DESC'
```
### Deletion of article:
```bash
curl -i -X DELETE http://localhost:9080/articles/1
```
## Run functional tests:
cd func-test
./gradlew clean build
Check functional test report [here](func-test/build/spock-reports/index.html)
## Related project
Same project but with usage of Spring Boot 2 available [here](https://github.com/andrei-punko/spring-boot-2-jsonb)