Advent of Spring Boot - DAY15 - Validation with annotation using spring-boot-starter-validation

Опубликовано: 23 Июль 2026
на канале: Xavier Bouclet
35
1

🌟 Day 15: Validating Properties with Jakarta Validation in Spring Boot 🌟

Hello Youtube! 👋

It’s Day 15 of the Spring Boot Advent of Code series, and today we ensured our application configurations are rock-solid by using Jakarta Validation to validate properties! ✅✨

Here’s what we explored in this episode:

✅ Adding validation constraints like @NotNull, @Min, @Max, @Pattern, and more to your configuration properties.
✅ Enabling validation on @ConfigurationProperties with @Validated.
✅ How to handle invalid properties gracefully and debug startup errors effectively.
✅ Real-world examples of validating common configurations such as URLs, port numbers, and string patterns.
✅ Best practices for ensuring safe and reliable application configuration.

Why this matters: Properly validated properties prevent misconfigurations from propagating, ensuring your application is predictable and robust from the very start.

Have you tried validating your configuration properties yet? Let’s talk about how it improved your projects in the comments!

#SpringBoot #ConfigurationProperties #JakartaValidation #PropertyValidation #Java23 #AdventOfCode #backenddevelopment

🔗 Resources & Links mentioned in this video:

GitHub Repo: https://github.com/mikrethor/adventof...

🎬 All the videos for Advent of Spring Boot:

DAY 1: Create a Spring Boot app -    • Advent of Spring Boot - DAY01 - Build your...  
DAY 2: Add endpoints -    • Advent of Spring Boot - DAY02 - Add endpoints  
DAY 3: Handle http code response - https://youtube.com/live/J1xApH7iWE8
DAY 4: Use RouterFunction instead of RestController - https://youtube.com/live/aMnop_HB91g
DAY 5: Error handling -    • Advent of Spring Boot - DAY05 - Error hand...  
DAY 6: Customize error payload with ProblemDetail -    • Advent of Spring Boot - DAY06 - Use Proble...  
DAY 7: Add a real db (PostgreSQL) -    • Advent of Spring Boot - DAY07 - Use a real...  
DAY 8: Unit testing with Mockito -    • Advent of Spring Boot - DAY08 - Unit tests...  
DAY 9: Integration test with MockMvc -    • Advent of Spring Boot - DAY09 - Integratio...  
DAy10: Integration test with RestAssured -    • Advent of Spring Boot  - DAY10 - Integrati...  
DAY11: Integration test with TestContainers -    • Advent of Spring Boot - DAY11 - Use the re...  
DAY12: Document your API with Swagger Doc -    • Advent of Spring Boot - DAY12 - Document y...  
DAY13: Document your API with Spring Rest Doc & eDocs -    • Advent of Spring Boot - DAY13 - Document y...  
DAY14: Properties Configuration with record -    • Advent of Spring Boot - DAY14 - Handle you...  
DAY15: Fields Validation -    • Advent of Spring Boot - DAY15 - Validation...  
DAY16: Build your API with a Dockerfile -    • Advent of Spring Boot - DAY16 - Build your...  
DAY17: Build your API with buildpacks -    • Advent of Spring Boot - DAY17 - Build your...  
DAY18: Build your API with buildpacks & GraalVM -    • Advent of Spring Boot - DAY18 - Build your...  
DAY19: Monitor your api with actuator -    • Advent of Spring Boot - DAY19 - Need to in...  
DAY20: Custom metrics with avtiuator and Micrometer -    • Advent of Spring Boot - DAY20 - Expose met...  
DAY21: Communicate with another API - the RestClient -    • Advent of Spring Boot - DAY21 - Connect yo...  
DAY22: Communicate with another API - the Http Interface -    • Advent of Spring Boot - DAY22 - Connect yo...  
DAY23: Improve UX with caching -    • Advent of Spring Boot - DAY23 - Having per...  
DAY24: Supercharge your API with Spring AI - RAG -    • Advent of Spring Boot - DAY24 - Need to ad...  

👋🏻 Connect with me:
Website: https://www.xavierbouclet.com
Twitter: https://x.com/XavierBOUCLET
Github: https://github.com/danvega
LinkedIn:   / 🇨🇦-xavier-bouclet-667b0431  

SUBSCRIBE TO MY CHANNEL:    / @xavierbouclet   ❤️