A robust web application for managing a movie library, developed as a student assignment focusing on the Spring Boot framework. The application enables users to list, search, add, edit, and delete movies through a clean web interface.
- CRUD: Full support for Movies.
- Architecture: Clear separation between Controller -> Service -> Repository.
- DTO Pattern: Separate DTOs for Create, Update, and View actions.
- Validation: Bean Validation (Jakarta) used in both Entities and DTOs.
- Custom Error Handling: Implements
ResourceNotFoundExceptionand@ControllerAdvice.
- Search/Filter: Search functionality implemented via Repository queries.
- Pagination: Server-side pagination using
PageableandPage. - Database Migrations: Flyway used for schema versioning.
- Service Tests: Unit tests for business logic.
- Mapper Tests: Unit tests for Entity-DTO conversion.
- Web Tests:
MockMvctests for controllers and view resolution.
- Java: 25
- Framework: Spring Boot 4.0.3
- Web: Spring MVC & Thymeleaf (Template Engine)
- Frontend UI: Bootstrap 5
- Data: Spring Data JPA & Flyway
- Database: PostgreSQL 15 (via Docker)
- Tools: Maven, Docker, Mockito
To run this project, you will need:
- JDK 25 installed on your system.
- Docker & Docker Compose installed and running.
- Maven 3.9.x or later.
The application requires a PostgreSQL database. Start it using the provided Docker Compose file:
docker-compose up -dThis will start a Postgres container in the background and map it to port 5432.
You can run the app via IntelliJ or the terminal:
Via IntelliJ:
- Open the project and ensure Project SDK is set to Java 25.
- Run
MyMovieAppApplication.java.
Via Terminal:
mvn spring-boot:runOpen your browser and go to:
- Main Application: http://localhost:8080/movies
- Flyway: On startup, Flyway automatically runs all migration scripts found in
src/main/resources/db/migrationto set up your tables. - DataInitializer: The application is pre-configured with a
DataInitializerthat populates the database with sample movies if the database is empty.
The project includes REST controller testing using @WebMvcTest and MockMvc.
- To run tests:
mvn test - Note: This project uses
@MockitoBean(available in Spring Boot 3.4+) for modern service mocking.
src/main/java/org/mymovieapp/controller: Handles HTTP requests and UI interaction.src/main/java/org/mymovieapp/service: Contains the business logic and orchestration.src/main/resources/db/migration: SQL scripts for database versioning.docker-compose.yml: Configuration for the PostgreSQL container.
This project uses GitHub Actions to ensure code quality:
- Automated Builds: Every push to the
mainbranch triggers a build using Maven and JDK 25. - Automated Testing: All JUnit tests are executed in a clean environment.