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

Springboot project error-The Bean Validation API is on the classpath but no implementation could be found
Create a simple cxf integrated springboot project, but the console reports an error "The Bean Validation API is on the classpath but no implementation could be found", as shown in the figure:
insert image description here

But there is only a simple Bean User class in my project, and Validation is not used. Why is there an error?

Checked online, the reason is version incompatibility.

solution

If you need to use validation, it is recommended to add a validation implementation in the dependency, such as hibernate-validator, select the version yourself, and the pom.xml depends on the following,

org.hibernate hibernate-validator 6.1.2.Final
If the validation is not used temporarily, it is recommended to exclude the validation dependency. Check which dependency you use validator-api, and exclude it in which dependency, such as mine It is useful in cxf-spring-boot-starter, so I will exclude it from the dependency. The pom is shown in the figure:
insert image description here

Click Run to return to normal.

Guess you like

Origin blog.csdn.net/weixin_44659084/article/details/130200967