Spring MVC 3 Validation - Unable to find a default provider

后端 未结 3 538
甜味超标
甜味超标 2020-12-14 15:24

I get an error when trying to set up Spring MVC validation.

javax.validation.ValidationException: Unable to find a default provider

I read

相关标签:
3条回答
  • 2020-12-14 15:39

    If you are using Maven, you must add a dependency to the Hibernate Validator Annotation Processor.

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator-annotation-processor</artifactId>
      <version>4.1.0.Final</version>
    </dependency>
    

    You can find it in the JBoss repository :

    <repository>
      <id>JBoss Repository</id>
      <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
      <name>JBoss Repository</name>
    </repository>
    
    0 讨论(0)
  • 2020-12-14 15:42

    Yes, you should include Hibernate Validator library in order to use it. It doesn't depend on Hibernate itself.

    0 讨论(0)
  • 2020-12-14 15:51

    Make sure you're using Hibernate 4.

    0 讨论(0)
提交回复
热议问题