springboot Initialization of bean failed; nested exception is javax.validation.ValidationException问题

springboot 1.5.14.RELEASE 读取自定义配置文件属性出现问题


2018-10-19 15:06:11.471  WARN 7884 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nearlineConfig' defined in file [D:\news.recommend\Trunk\news_recommed_reckon_java\recommend_result\recommend_new\recommend_nearline\target\classes\com\tnaot\recommend_nearline\base\config\NearlineConfig.class]: 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-10-19 15:06:11.477  INFO 7884 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-10-19 15:06:11.484 ERROR 7884 --- [           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

解决办法,在pom.xml添加以下依赖:

        
            org.hibernate
            hibernate-validator
            5.2.1.Final
        
        
            org.hibernate
            hibernate-validator-annotation-processor
            5.2.1.Final
        

 

你可能感兴趣的:(spring,boot)