PostgreSQL JSON and enum column support
This project demonstrates a reactive Spring Boot application using R2DBC with PostgreSQL JSON column support. It implements a blog-like system with posts and comments, featuring pagination and reactive endpoints.
Features
Reactive REST API using Spring WebFlux
R2DBC with PostgreSQL for reactive database operations
JSON column support for flexible data storage
Flyway database migrations
Pagination and sorting support
Docker support with health checks
Comprehensive test coverage using TestContainers
Metrics and tracing with Micrometer
Prerequisites
JDK 21
Docker and Docker Compose
PostgreSQL 15+
Getting Started
Clone the repository
Run PostgreSQL using Docker:
Run the application.
API Endpoints
GET /posts?page=0&size=10&sort=title&direction=ASC
- Get paginated postsGET /posts/{id}
- Get a specific postPOST /posts
- Create a new postPUT /posts/{id}
- Update a postDELETE /posts/{id}
- Delete a postGET /posts/{postId}/comments
- Get comments for a postPOST /posts/{postId}/comments
- Add a comment to a post
Architecture
Running Tests
The project includes both unit and integration tests using TestContainers:
Docker Deployment
Build and run the application using Docker:
Monitoring
The application exposes various actuator endpoints for monitoring:
Health:
/actuator/health
Metrics:
/actuator/metrics
Info:
/actuator/info
Configuration
Key application properties can be configured in application.properties
:
Database connection settings
Logging levels
Jackson JSON settings
Management endpoints
Last updated