zoukankan      html  css  js  c++  java
  • Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactory


    Error creating bean with name ‘org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0’

    Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
        at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
        at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:188)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
        ... 65 more

    错误原因:是因为我们在使用javax.validation的时候,还需要一个javax.validation的实现包,因为validation只是一个协议,可以使用hibernate-validator这个实现包,完整的使用如下:

     <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
            </dependency>

    http://blog.csdn.net/xlgen157387/article/details/49799973

    http://www.cnblogs.com/yjmyzz/p/gradle-to-maven.html

  • 相关阅读:
    oracle——笔记——DDL语句
    Oracle中exp,imp的使用详解
    File类的简单使用
    理解Java的IO 流
    MyEclipse反编译Class文件的实现
    程序算法与人生选择
    Oracle 11g服务器与客户端卸载、安装
    Oracle字符集的查看查询和Oracle字符集的设置修改
    Java 对象的序列化 (Serializable)和反序列化
    Oracle创建表空间、创建用户以及授权、查看权限
  • 原文地址:https://www.cnblogs.com/softidea/p/5631143.html
Copyright © 2011-2022 走看看