Spring Boot 4 application for managing digital wallets in a payments system. Supports user registration, wallet creation, deposits, withdrawals, and peer-to-peer transfers with atomic balance updates and transaction logging.
This repository provides a project skeleton for a RESTful microservice using Java 17, Gradle Kotlin DSL, Spring Data JPA, and PostgreSQL. The initial implementation covers user registration and wallet creation with full test coverage. Extend it to implement additional features per INSTRUCTIONS.md.
Distributed as a ZIP archive including Git history for tracking development progress.
Group: com.rs.payments. Version: 0.0.1-SNAPSHOT. Description: wallet-service.
- Java 17 (JDK, enforced via toolchain)
- Gradle 8.x (via wrapper)
- Docker and Docker Compose (for local database and Testcontainers)
- IntelliJ IDEA or compatible IDE (recommended for Spring Boot and Gradle support)
- Git (for history inspection)
- Extract the ZIP archive to a directory:
unzip wallet-service.zip(or use GUI tool). - Navigate to the project root:
cd wallet-service. - Inspect Git history:
git log --oneline(demonstrates initial commits). - Import into IDE: Open as Gradle project in IntelliJ (File > Open > select
build.gradle.kts).
Starts PostgreSQL and the application container. (Assumes docker-compose.yml presence; configure as needed.)
docker-compose up --build- Application: http://localhost:8080
- Database: localhost:5432 (user:
user, password:password, db:walletdb) - Logs: Monitor via
docker-compose logs -f
Stop with docker-compose down.
- Start PostgreSQL:
docker-compose up -d db. - Run application:
./gradlew bootRun(or IDE run configuration for main class).
Configuration uses application.yml for local datasource (update URL if needed).
- OpenAPI/Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/v3/api-docs
Endpoints (initial):
POST /users: Create user.POST /wallets: Create wallet for user.
Run static analysis tools via Gradle tasks.
- Checkstyle (main sources):
./gradlew checkstyleMain - PMD (main sources, custom ruleset):
./gradlew pmdMain - SpotBugs (main sources, HTML/XML reports in
build/reports/spotbugs):./gradlew spotbugsMain - All checks:
./gradlew check(includes unit/integration tests)
Failures are ignored by default; review reports for issues.
Uses JUnit 5, Mockito, and Testcontainers for PostgreSQL. Tests in src/test/java; integration tests in src/integration/java (tagged @Tag("integration")).
- Unit tests:
./gradlew test - Integration tests:
./gradlew integrationTest - All tests:
./gradlew check - Coverage report (JaCoCo, HTML in
build/reports/jacoco/test/html/index.html, XML inbuild/reports/jacoco/test/jacocoTestReport.xml):./gradlew jacocoTestReport(runs after tests)
Aim for 100% coverage on new code.
./gradlew buildProduces executable JAR: build/libs/wallet-service-0.0.1-SNAPSHOT.jar.
Run JAR: java -jar build/libs/wallet-service-0.0.1-SNAPSHOT.jar.
Clean build: ./gradlew clean build.
Hibernate DDL auto: update (dev only). Entities (using UUID for primary keys):
users: id (UUID), username, email (unique).wallets: id (UUID), balance (one-to-one with user).transactions: id (UUID), amount, type, timestamp.
Implement user stories in INSTRUCTIONS.md using TDD. Commit incrementally to the main branch with descriptive messages (e.g., "Add failing test for deposit endpoint").
For CI: .github/workflows/ci.yml runs on push/PR (adapt as needed).
To prepare the project for submission, run:
./gradlew prepareSubmissionThis creates a ZIP file: submission-<your-username>-<date>.zip.
Important:
- If the file name ends with
-anonymous, the submission will not be accepted. - Ensure your git author name is set correctly:
git config user.name "Your Name" git config user.email "your.email@example.com"
- Commit your changes before running the task.
- Port conflict: Change
server.portinapplication.yml. - Database connection: Verify Docker container health (
docker ps); check logs. - Gradle issues:
./gradlew cleanand retry; ensure Java 17 viajava -version. - Tests fail: Ensure Docker for Testcontainers; use
create-dropmode in tests. - Lombok issues: Enable annotation processing in IDE.
For questions, refer to INSTRUCTIONS.md.