Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBe

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>

版权声明:本文为博主原创文章,未经博主允许不得转载。

Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBe

时间: 2024-10-14 00:54:31

Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBe的相关文章

Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name &#39;org.springframework.aop.aspectj.AspectJPointcutAdvisor#0&#39; 两个异常解决办法

贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://ww

spring测试出错:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0&#39;:

解决办法 这里找不到根路径,也就找不到Spring-config.xml的配置,所以加上更改根路径的注解@WebAppConfiguration(“src/main/resources”)就解决了 1 @RunWith(SpringJUnit4ClassRunner.class) 2 @WebAppConfiguration("src/main/resources") //加上这个注解完美解决 3 @ContextConfiguration(locations = {"cla

org.springframework.beans.factory.BeanCreationException: Error creating bean with name

这个问题在别人电脑上面没有出现,但我的电脑就出现了,在网上找各种解决方法:有的说是asm.jar冲突,有的说要配置byName,有的说是路径问题但路径明显是正确的. 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.B

spring AOP使用中Error creating bean with name ‘…’defined in class path resource..问题及其解决方法

2018/3/24 异常小记 工作环境:myeclipse2015(jar与java compiler 版本一致).windows10 工作内容:spring 中AOP的使用测试 异常信息: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuthBeforeAdvice' defined in class

ssm整合时出现 org.springframework.beans.factory.BeanCreationException :Error creating bean with name ‘XXX’ 异常的原因及解决方法

ssm整合时出现 org.springframework.beans.factory.BeanCreationException :Error creating bean with name 'XXX' 异常的原因及解决方法(只是可能出现下列几种,不包含全部) 此异常为:注入 bean 失败异常,也就是找不到注入的bean. 可能有以下几种原因: 1.bean未注解或者注解错误 2.项目整合的时候jar包冲突 3.'XXX'的配置有错误 解决:1,3仔细检查就是,网上大部分的人应该是2这种错误,

【报错】org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;webSocketHandlerMapping&#39; defined in class path resource

环境:maven+eclipse+jdk1.8 [tomcat使用的是maven自带的插件,实质原因就是出在tomcat版本问题] 背景:在进行SSM集成WebSocket的时候,项目启动报org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource错误,详细如下 org.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;sqlSessionFactory&#39;

spring整合mybatis的时候,传统dao模式test报错 发现是在pojo类user对应的user.xml中配置路径写错了 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init m

org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;org.mybatis.spring.mapper.MapperScannerConfigurer#0&#39; defined in class path resource

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exc

【实战问题】【14】org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;xxMapper&#39;

问题: SpringBoot启动时报错: Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name 'userDaoMapper' defined in file [E:\WebProject\... 解决方案: pom.xml文件引入了两个Mybatis依赖包.一个是整合SpringBoot的,一个是整合Spring的jar包.两个一