Caused by: 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.one.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
这个问题卡了我两天多的时间,我在这里犯了一个很简单的错误,我在主启动类上忘记添加
@MapperScan("")注解了,导致mapper中的类扫描不到。加上这个注解后就行了。
这又是一个注解忘记写惹下的祸,因为这个问题浪费了大量时间是很不值得的。
如果有类似的问题先看自己的注解又没有少,没有再看自己的路径问题和包有没有扫描到,细心一点这样的问题就能够避免,还能节省自己大量时间和精力