Sunday, 16 June 2019

Setting up Environment for hibernate-validator


I am going to use Hibernate validator '6.0.10.Final'.
  <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>6.0.10.Final</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
  <dependency>
   <groupId>javax.validation</groupId>
   <artifactId>validation-api</artifactId>
   <version>2.0.1.Final</version>
  </dependency>


Since Hibernate validator requires an implementation of Unified Expression Language (JSR 341) specification. If you are using Hibernate-validator in standalone servlet container such as tomcat, jboss then these dependencies are already provided. But if you are using Hibernate-validator in standalone application, then you need to provide below JSR 341 dependencies manually.

  <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
  <dependency>
   <groupId>javax.el</groupId>
   <artifactId>javax.el-api</artifactId>
   <version>3.0.1-b04</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.glassfish.web/javax.el -->
  <dependency>
   <groupId>org.glassfish.web</groupId>
   <artifactId>javax.el</artifactId>
   <version>2.2.6</version>
  </dependency>


My pom.xml looks like below.

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>hibernateValidator</groupId>
 <artifactId>hibernateValidator</artifactId>
 <version>1</version>

 <dependencies>
  <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>6.0.10.Final</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
  <dependency>
   <groupId>javax.validation</groupId>
   <artifactId>validation-api</artifactId>
   <version>2.0.1.Final</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
  <dependency>
   <groupId>javax.el</groupId>
   <artifactId>javax.el-api</artifactId>
   <version>3.0.1-b04</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/org.glassfish.web/javax.el -->
  <dependency>
   <groupId>org.glassfish.web</groupId>
   <artifactId>javax.el</artifactId>
   <version>2.2.6</version>
  </dependency>

 </dependencies>
</project>



Previous                                                 Next                                                 Home

No comments:

Post a Comment