UnsatisfiedDependencyException: Error creating bean with name ‘userController‘ 已解决

启动SpringBoot出错

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

原因

@MapperScan(“com.xxx.mapper”) 没写或者写错
该注解可以写在SpringBootApplication启动类上或者在自定义配置类上

猜你喜欢

转载自blog.csdn.net/weixin_46195957/article/details/115870043