Description:
Parameter 6 of constructor in com.ruoyi.system.service.impl.SysUserServiceImpl required a bean of type ‘javax.validation.Validator’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Qualifier(value=securityManager)
Action:
Consider defining a bean of type ‘javax.validation.Validator’ in your configuration.
控制台:
报错解释:
这个错误表明Spring框架在尝试自动装配一个javax.validation.Validator类型的bean时失败了。Validator是Bean验证的API,用于在将对象提交给业务逻辑之前验证对象的字段是否符合要求。如果Spring容器中没有定义这种类型的bean,就会抛出这个错误。
解决方法:
如果你正在使用Spring Boot,通常情况下,只需要在你的依赖管理文件中(如pom.xml或build.gradle)添加spring-boot-starter-validation依赖即可。
对于Maven,在pom.xml中添加:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>