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

 

时间: 2024-10-29 07:11:11

Error creating bean with name &#39;org.springframework.validation.beanvalidation.LocalValidatorFactory的相关文章

Error creating bean with name &amp;#39;sessionFactory&amp;#39; defined in ServletContext resource [/WEB-INF/applica

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoun

Error creating bean with name &amp;#39;sessionFactory&amp;#39; defined in file

在hibernate和spring整合时,出现错误如下: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [G:\workspace\s_hibernate\src\applicationContext.xml]: Invocation of

spring cloud 报错Error creating bean with name &amp;#39;hystrixCommandAspect&amp;#39; ,解决方案

  spring cloud 升级到最新版 后,报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hystrixCommandAspect' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.cla

s2sh-【求助】关于S2SH整合遇到的Error creating bean with name &amp;amp;#39;sessionFactory&amp;amp;#39;

问题描述 [求助]关于S2SH整合遇到的Error creating bean with name 'sessionFactory' 这是生成的applicationContext.xml配置: <?xml version="1.0" encoding="UTF-8"?> xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.

Error creating bean with name &amp;amp;#x27;org.springframework.validation.beanvalidation.Loc

问题描述 求大神解决Exceptioninthread"main"org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0':Invocationofinitmethodfailed;nestedexceptionisjavax.val

spring 错误 error creating bean with name

问题描述 spring 错误 error creating bean with name org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in class path resource [beans.xml]: Instantiation of bean failed; nested exception is org.spring

Error creating bean with name &amp;#039;sessionFactory

问题描述 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in

ssh 框架问题 能显示页面,但是出现Error creating bean with n

问题描述 ssh 框架问题 能显示页面,但是出现Error creating bean with n 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error crea

Spring中的经典疑问: Error creating bean with name &amp;#039;urlMapping&amp;#039; ...

问题描述 正在学习spring的多动作控制器,然而配置完成运行后,出现了这样的错误信息,我估计很多老鸟见过,如下: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.