A web application for managing a movie collection, built with Spring Boot, Spring MVC, Spring Data JPA, and Thymeleaf.
- List all movies with search and filter functionality
- Create new movies via form
- Edit existing movies
- Delete movies
- Filter by title, director, genre, and minimum rating
- Pagination with configurable page size
- Validation with error messages in forms
- Custom error handling with meaningful error pages
- Java 25
- Spring Boot 4.0.3
- Spring MVC
- Spring Data JPA
- Thymeleaf
- H2 (in-memory database)
- Bean Validation (Jakarta Validation)
- JUnit 5 + Mockito
src/main/java/com/example/movieapp/
├── config/
├── controller/
│ ├── HomeController.java
│ └── MovieController.java
├── dto/
│ ├── CreateMovieDTO.java
│ ├── MovieDTO.java
│ ├── MovieFilterDTO.java
│ └── UpdateMovieDTO.java
├── entity/
│ └── Movie.java
├── exception/
│ ├── DuplicateTitleException.java
│ ├── GlobalExceptionHandler.java
│ └── ResourceNotFoundException.java
├── mapper/
│ └── MovieMapper.java
├── repository/
│ └── MovieRepository.java
└── service/
└── MovieService.java
src/main/resources/
├── static/
├── templates/
│ ├── error/
│ │ └── error.html
│ └── movies/
│ ├── create.html
│ ├── detail.html
│ ├── edit.html
│ └── list.html
└── application.properties
- Java 25
- Maven
mvn spring-boot:runOpen your browser and navigate to http://localhost:8080.
mvn testThe application follows a layered architecture:
- Controller – Handles HTTP requests and returns Thymeleaf views
- Service – Contains business logic and coordinates between controller and repository
- Repository – Data access layer using Spring Data JPA
- Mapper – Converts between entities and DTOs
- Entity – JPA-mapped domain object persisted to the database
- DTO – Separate data transfer objects for create, update, and view operations
| Field | Type | Description |
|---|---|---|
| id | Long | Auto-generated primary key |
| title | String | Movie title (max 200 characters) |
| description | String | Movie description (max 2000 characters) |
| releaseDate | LocalDate | Release date |
| director | String | Director name |
| runtimeMinutes | Integer | Runtime in minutes (1-1200) |
| genre | String | Movie genre |
| rating | Double | Rating from 0.0 to 10.0 |
| Method | URL | Description |
|---|---|---|
| GET | /movies | List all movies with optional filters |
| GET | /movies/{id} | View movie detail |
| GET | /movies/new | Show create form |
| POST | /movies/new | Save new movie |
| GET | /movies/{id}/edit | Show edit form |
| POST | /movies/{id}/edit | Update movie |
| POST | /movies/{id}/delete | Delete movie |