Bean Validation Using The Hibernate Validator
Let’s learn to validate the request data for the REST APIs.
Add validation dependency
First, let’s add the validation dependency provided by Spring Boot— spring-boot-starter-validation
—into our build.gradle
file.
Press + to interact
dependencies {implementation 'org.springframework.boot:spring-boot-starter-validation'}
This will add the required hibernate-validator
dependency to our todo
appilcation, allowing us to express and validate constraints on the entity for request validation.
Entity setup for validation
Javax’s validation framework provides a few ...