Spring Boot:The Bean Validation API is on the classpath but no implementation could be found

参考:
https://stackoverflow.com/questions/41879541/spring-boot-sample-unable-to-start-embedded-container-error

问题描述:
在搭建Spring Boot项目,最简单的Hello World实例,没有用什么Hibernate Validator,而且在1.5.8.RELEASE版本之前的都能正常,但就从1.5.9.RELEASE 开始出现这个问题。
下面是1.5.10.RELEASE 具体的错误


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-08 16:56:27.687  INFO 6388 --- [           main] com.qin.spring.demo.DemoApplication      : Starting DemoApplication on qin-PC with PID 6388 (D:\Workspaces\workspace-sts-3.9.2.RELEASE\demo\target\classes started by qin in D:\Workspaces\workspace-sts-3.9.2.RELEASE\demo)
2018-02-08 16:56:27.689  INFO 6388 --- [           main] com.qin.spring.demo.DemoApplication      : No active profile set, falling back to default profiles: default
2018-02-08 16:56:27.818  INFO 6388 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3aefe5e5: startup date [Thu Feb 08 16:56:27 CST 2018]; root of context hierarchy
2018-02-08 16:56:28.136  WARN 6388 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.qin.spring.demo]' package. Please check your configuration.
2018-02-08 16:56:28.155  INFO 6388 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-02-08 16:56:28.390  INFO 6388 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$57928285] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-08 16:56:28.454  WARN 6388 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties': Initialization of bean 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.
2018-02-08 16:56:28.460  INFO 6388 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-02-08 16:56:28.464 ERROR 6388 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Bean Validation API is on the classpath but no implementation could be found

Action:

Add an implementation, such as Hibernate Validator, to the classpath

解决方法:
直接删除.m2文件夹(你的本机maven仓库)下的文件夹
com\fasterxml
org\springframework
org\hibernate

猜你喜欢

转载自blog.csdn.net/u012903926/article/details/79291739