SpringBoot注入baseMapper异常

这是一个多次遇到一不留神就忘记的问题,记录一下

问题描述:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pefPasserbyCarController': Unsatisfied dependency expressed through field 'pefPasserbyCarService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pefPasserbyCarServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.spring.blocklinked.block.mapper.PefPasserbyCarMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

解决方法:
加上 @MapperScan(“com.spring.blocklinked.*.mapper.**”)

你可能感兴趣的:(base)