SpringBoot整合Mybatis-Plus自动装配@Autowired失效问题

最近在使用springboot整合mybatis-plus时遇到@Autowired失效问题,百思不得其解!!!

项目结构如下:

 启动类LsTestApplication:

控制器UserController:

实现类UserServiceImpl:

UserMapper:

 

 启动之后一直报错,报错信息如下:

2019-08-23 17:16:16.457  WARN 8528 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: 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.sand.demo.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

猜测可能是组件没扫描到,但是使用IDEA开发工具查看是有的,而且启动类的路径感觉也没啥问题

 

猜你喜欢

转载自www.cnblogs.com/54hsh/p/11401597.html