Week 4

Java Annotations

Introduction to REST

Spring Boot Setup

Writing Endpoints

Message Formats

Input Validation

Practice

Assignment

Back end Track

Under construction

<aside> 🚧

This page is currently under construction. Please check back later.

</aside>

Implementation plan:

  1. Why validate input — never trust the client
  2. Adding the spring-boot-starter-validation dependency
  3. Bean Validation annotations: @NotNull, @NotBlank, @Size, @Min, @Max, @Email, @Pattern
  4. Applying annotations to DTO fields
  5. @Valid annotation on @RequestBody parameters
  6. What happens when validation fails (default behavior)
  7. Customizing validation error responses with @ExceptionHandler
  8. Nested object validation
  9. Exercise: add validation to existing endpoints

The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0

CC BY-NC-SA 4.0 Icons

*https://hackyourfuture.net/*

Found a mistake or have a suggestion? Let us know in the feedback form.