Java Annotations
Introduction to REST
Spring Boot Setup
Writing Endpoints
Message Formats
Input Validation
Practice
Assignment
Back end Track
Week 4 Overview
Previously in Week 3 - Data Structures & Testing you learned to:
- Store and retrieve data using Java Collections.
- Write type-safe code with Generics.
- Represent fixed sets of values with Enums.
- Process collections with the Stream API.
- Write unit tests with JUnit 5 and
- Tap into the runtime and traverse your code as part of Debugging in Java
This week, you will start building REST APIs with Spring Boot. You will move from writing Java programs to designing HTTP endpoints, running a local web server, sending and receiving JSON, and validating the data that clients send to your application.
You have already called APIs as a client in the Core Program. Now you will switch sides and build the server that receives those requests and returns useful responses.
Learning goals
By the end of this week, you will be able to:
- Java Annotations: Explain how annotations add metadata to code and how tools such as JUnit, Jackson, and Spring Boot use them.
- REST API Design: Model resources with clear URIs and choose suitable HTTP methods, headers, and status codes.
- Spring Boot Setup: Generate, import, configure, and run a Spring Boot project with Spring Web.
- Writing Endpoints: Build REST controllers with annotations such as
@RestController, @RequestMapping, @RequestParam, @RequestBody , and so on.
- Message Formats and DTOs: Use Jackson to convert Java objects to JSON and use DTOs to shape API requests and responses.
- Input Validation: Validate request data with Jakarta Bean Validation,
@Valid, and exception handlers that return clear error responses.
The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0
*https://hackyourfuture.net/*

Built with ❤️ by the HackYourFuture community · Thank you, contributors
Found a mistake or have a suggestion? Let us know in the feedback form.