Java

How to Grouping and restricting constraints using Bean Validation?

We already know that the Bean Validation specification is very helpful for performing validations. There is also the possibility of validating using groups. Imagine the following scenario: a DTO for products and another one for categories, as in the following example: When trying to register a product by specifying the category id, we encounter an…

Read More
Java

What is Java Bean Validation and how to use it?

Bean Validation is a specification for performing validations in Java and can have multiple implementations. To avoid writing repetitive validation code, Java provides Bean Validation (standard specified by JSR 380, also known as Jakarta Bean Validation), which allows applying rules directly to class attributes using annotations. When developing Java applications, it is common to validate…

Read More