springboot 报错Field XXX required a bean of type XXX that could not be found.

报错原因:

MyBatis是第三方组件,spring并不会自动管理MyBatis相关对象的生命周期,因此需要手动配置,将MyBatis相关对象交给spring容器来管理。

解决方式:

在启动类中增加注解@MapperScan("cn.lxy.repository")

 

posted @ 2020-02-12 19:51  thinkworld  阅读(922)  评论(0编辑  收藏  举报