@autowired Could not autowire. No beans of 'SysUserBeanMapper' type found
方案一
在自动转配的注解后面添加(required=false)
当我们在使用@Autowired注解的时候,默认required=true,表示注入的时候bean必须存在,否则注入失败。
方案二
在SysUserBeanMapper上面添加
@Component(value ="sysUserBeanMapper")
@Component注解,表明当需要创建类时,这个被注解的类是一个候选类。相当于类交给Spring管理,重新起个名字叫userMapper,但是并不推荐这样做。
在SpringBoot中集成MyBatis,可以在mapper接口上添加@Mapper注解,将mapper注入到Spring。但是如果每一给mapper都添加@mapper注解会很麻烦!!!
这时可以使用@MapperScan注解来扫描包。一般在Application上面标注了MapperScan
方案三
@Autowired修改成@Resource即可解决