Building REST APIs with Spring Boot
Build a production-quality REST API with Spring Boot and PostgreSQL. Covers controllers, service layers, JPA, Bean Validation, error handling, and pagination through incremental hands-on exercises.
View badge details
About This Course
Course Curriculum
14 Lessons
Spring Boot Fundamentals & Project Setup
Learn what Spring Boot is and why it exists. Covers auto-configuration, the Spring application context, Maven project structure, @SpringBootApplication, embedded Tomcat, application.properties, Spring Boot starter dependencies, and running and verifying a Spring Boot app.
Spring Boot Setup - Lab Exercises
Hands-on exercises verifying the Spring Boot starter project, creating a HelloController with REST endpoints, and adding a health check endpoint. Students confirm the Meridian Logistics API starts and responds correctly.
REST Controllers & HTTP Methods
Learn REST conventions, Spring MVC controller annotations (@RestController, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping), path variables, request parameters, request body deserialization, ResponseEntity for status codes, and the importance of DTOs over exposing JPA entities directly.
REST Controllers - Lab Exercises
Hands-on exercises implementing stub methods in TaskController: returning a hardcoded task list, echoing a POST request body, returning a single task, and testing all endpoints with curl commands.
Service Layer & Dependency Injection
Learn why the service layer exists, how Spring manages beans (@Service, @Component, @Repository), constructor injection vs field injection, interface-based service design, and the controller-service-repository chain. Emphasizes why constructor injection is preferred over @Autowired field injection.
Service Layer - Lab Exercises
Hands-on exercises implementing TaskService interface and TaskServiceImpl with an in-memory List backing store, wiring TaskController to use constructor-injected TaskService, and verifying the full controller-service chain with curl POST and GET commands.
Spring Data JPA & Repositories
Learn JPA entity annotations (@Entity, @Table, @Id, @GeneratedValue, @Column, @Enumerated), entity lifecycle, Spring Data JpaRepository with built-in CRUD methods, derived query methods, @Transactional, and ddl-auto settings. Students understand how to configure PostgreSQL persistence for the Task API.
JPA & Repositories - Lab Exercises
Hands-on exercises annotating Task.java as a JPA entity, creating TaskRepository with derived query methods, switching TaskServiceImpl from in-memory List to repository calls, and verifying that tasks persist across server restarts using PostgreSQL.
Request Validation & Error Handling
Learn Bean Validation (@Valid, @NotBlank, @NotNull, @Size, @FutureOrPresent), @RestControllerAdvice for global exception handling, structured ApiError response body, custom TaskNotFoundException, and proper HTTP status codes for validation failures (400) vs missing resources (404).
Validation & Errors - Lab Exercises
Hands-on practice adding Bean Validation and global error handling to the Task Manager REST API. Annotate DTOs, build a GlobalExceptionHandler, and implement custom exceptions with meaningful error responses.
Pagination, Filtering & Sorting
Learn how Spring Data JPA's Pageable abstraction enables efficient large-dataset queries, how to add filtering by status and sorting by dueDate, and how to return Page objects with metadata to API consumers.
Pagination - Lab Exercises
Hands-on practice adding Pageable support to the Task Manager API, implementing status filtering, enabling dueDate sorting, and verifying the Page response structure.
Capstone Briefing
A comprehensive review of all API development skills covered in the course and a detailed briefing on the Task Manager capstone project requirements including the Category entity that students will implement in the final lesson.
Capstone Project
The final capstone project for Building REST APIs with Spring Boot. Students implement a complete Category management feature including entity relationships, full CRUD endpoints, validation, error handling, and paginated task listing.