Answer the question
In order to leave comments, you need to log in
What dependencies should I include to validate Spring Boot forms?
Something I got confused with dependencies, I started to google how to properly validate the form, namely email fields, so as not to crutch with regular expressions.
Found a resource that says
We will need the validation-api-1.1.0.Final.jar and hibernate-validator-5.0.1.Final.jar files in order to use the Bean Validation API in our Spring MVC application.
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
Answer the question
In order to leave comments, you need to log in
This is the difference between specification and implementation. Java EE is specifications. Agreements on how to continue to live in the conditions of a ruthless bloody enterprise. JPA is part of it, one of the specifications, for example.
Hibernate is one of the JPA implementations. In my opinion, even RI. Why are annotations from the Javax package used? To make it easier for the author to change the Hibernate library to another one without rewriting the code. Therefore, ceteris paribus, it is recommended to use Java EE annotations.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question