DOCSP-54965: Java backend scaffolding setup #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Setup of Java Spring Boot backend for the MongoDB Sample MFlix application
This PR implements the initial setup of a Java Spring Boot backend for the MongoDB Sample MFlix application (parity with the current Express.js/TypeScript backend). The implementation demonstrates direct MongoDB Java Driver usage for educational purposes while following Spring Boot best practices.
What to Review
Database Configuration (
config/)DatabaseVerificationrobustDomain Models (
model/)DTOs (
model/dto/)Response Models (
model/response/)SuccessResponse<T>correct@JsonInclude(NON_NULL)behavior desiredRepository Layer (
repository/)Service Layer (
service/)Controller Layer (
controller/)Exception Handling (
exception/)What's NOT in This PR
Testing (Future Work)
Advanced API Endpoints (Future Work)
Documentation (Partial)
Build Verification
API Endpoints
All endpoints are fully implemented and match the current Express backend:
Query Parameters (GET /api/movies)
q- Full-text searchgenre- Filter by genre (case-insensitive)year- Filter by year (exact match)minRating- Minimum IMDB ratingmaxRating- Maximum IMDB ratinglimit- Results per page (default: 20, max: 100)skip- Number of results to skipsortBy- Field to sort by (default: title)sortOrder- Sort order: asc or desc (default: asc)Design Decisions
Why Lombok?
Why Custom Repository (Not Spring Data)?
Why Manual BSON Conversion?
Why Nested Classes?
Movie.Awardsvs separateMovieAwardsclass)Testing Recommendations
Manual Testing
./mvnw spring-boot:runcurl http://localhost:3001/curl http://localhost:3001/api/movies?limit=5curl http://localhost:3001/api/movies/{id}curl -X POST http://localhost:3001/api/movies -H "Content-Type: application/json" -d '{"title":"Test Movie"}'curl -X PUT http://localhost:3001/api/movies/{id} -H "Content-Type: application/json" -d '{"year":2024}'curl -X DELETE http://localhost:3001/api/movies/{id}