报错:Error creating bean with name ‘Controller‘,Unsatisfied dependency expressed through field ‘Servic

报错来源:

  1. 初始化项目
  2. 生成代码注解不全 或 路径有错

报错信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘sysUserController’: Unsatisfied dependency expressed through field ‘sysUserService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘sysUserService’: Unsatisfied dependency expressed through field ‘baseMapper’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.xyz66.mapper.SysUserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

报错:Error creating bean with name ‘Controller‘,Unsatisfied dependency expressed through field ‘Servic_第1张图片

解决方案:

1.添加@MapperScan扫描mapper注解

报错:Error creating bean with name ‘Controller‘,Unsatisfied dependency expressed through field ‘Servic_第2张图片

2.添加@Mapper注解

在这里插入图片描述

你可能感兴趣的:(Java,java,spring,jvm)