Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.****.mybatis.springboot.mapper.UserMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
产生问题的原因在于,没有配置mapper层的扫描,解决办法如下:
@SpringBootApplication
@MapperScan({"club.hb168.tuanyou.mapper"})
public class TuanyouApplication {
public static void main(String[] args) {
SpringApplication.run(TuanyouApplication.class, args);
}
}