A modular Spring Boot project designed to explore, implement, and master various functionalities and database integrations. Each module is self-contained and focuses on a specific feature, built with Test-Driven Development (TDD) at its core. This project serves as a learning and demonstration platform for best practices in Spring Boot development.
spring-boot-box/
├── settings.gradle.kts # Gradle settings for module management
├── Makefile # Build, test, and run commands using Makefile
├── gradlew # Gradle wrapper script
├── gradlew.bat # Gradle wrapper for Windows
├── build.gradle.kts # Root Gradle configuration
├── README.md # Project documentation
├── app-db-h2-connection/ # Module for H2 database integration
├── app-db-postgres-connection/ # Module for PostgreSQL integration
├── app-db-mysql-connection/ # Module for MySQL integration
├── app-db-mongo-connection/ # Module for MongoDB integration
├── app-spring-security-basic # Module for Spring security (RBAC)
├── app-reactive-webflux-basic # Module for Spring Reactive webflux basic
├── app-(future modules...) # Additional modules for extended functionalities
- Modular Design:
- Each module is independent and focuses on a specific feature or database.
- Enables easy experimentation and integration of new ideas.
- TDD-Driven Development:
- Writing tests first to drive the implementation.
- Ensures reliable, maintainable, and bug-free code.
- Learning-Focused:
- A sandbox for learning Spring Boot features, database integrations, and advanced concepts.
This project uses a Makefile to simplify build, test, run, and other operations. The Makefile provides a consistent interface for managing project tasks across different environments. For Windows users, you can install make
using Chocolatey by running the following command:
choco install make
- Purpose: Demonstrates integration with H2, an in-memory database.
- Features:
- Quick prototyping and testing with in-memory persistence.
- RESTful APIs for CRUD operations.
- End-to-end tests for each feature.
- In the same project Introduced Behavior-Driven Development (BDD) using Cucumber. (TODO service)
- Purpose: Demonstrates integration with PostgreSQL.
- Features:
- Production-grade persistence with PostgreSQL.
- Proper connection pooling and configuration.
- RESTful APIs and corresponding test cases.
- Purpose: Demonstrates integration with MySQL.
- Features:
- Full MySQL database support for production use.
- Comprehensive CRUD APIs.
- Extensive testing for all operations.
- Purpose: Demonstrates integration with MongoDB, a NoSQL database.
- Features:
- Flexible schema design for NoSQL use cases.
- RESTful APIs for CRUD operations.
- Comprehensive test cases to ensure functionality.
- Suitable for projects requiring horizontal scalability.
- Purpose: Kick-start with Spring security (1.0).
- Features:
- A simple application with handle the Role based Access Control.
- Created RESTful APIs with Role based authorization.
- Created test to handle Role based authorization.
- Purpose: Kick-start with Spring Reactive Webflux.
- Features:
- A simple application with handle the Tasks (same as todo application).
- Created RESTful APIs with help of Reactive Components such as Mono, Flux.
- Created test to handle CRUD operations.
- Spring Security Integration 2.0:
- Implement basic authentication and authorization.
- Secure endpoints using Spring Security features.
- Reactive Programming with WebFlux 2.0:
- Add R2DBC for reactive database operations with other databases and with increase level complexity.
- Advanced Functionalities:
- Explore Spring Cloud for microservices.
- Build inter-service communication and monitoring.
- Add mutation testing with PIT (Pitest).
- Focus on integrating test automation pipelines.
- Java 17+ (or preferred version).
- Gradle (build tool).
- Build and Test All Modules:
make all
- Build Modules:
make
- Clean All Build Files:
make clean
- Run the Root Spring Boot Application: (by default it runs h2 application)
make run
- Run the Specific Application: (e.g. h2 application)
make run-h2
- Build and Test a Specific Module:
make run-module
- Testing Run all tests for the module:
make test
- Help
make help
The project leverages OpenAPI to provide interactive API documentation. This makes it easy to explore and test the REST APIs for each module.
- Start the Spring Boot application.
- Navigate to the following URL in your browser
http://localhost:8080/swagger-ui/index.html
- Replace
8080
with the appropriate port if a different one is configured.
- Replace
- Explore the API endpoints, input parameters, and responses in an interactive interface.
Note: In Case of Reactive WebFlux projects navigate to below URL:
http://localhost:8080/swagger-ui.html
Contributions are welcome! Feel free to fork the repository, create a new module, or enhance the existing ones.
Vishwajeet Kotkar
- A passionate developer focused on mastering Spring Boot, Test-Driven Development, and modern software practices.