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

Posted Mr.L

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot 报错Field XXX required a bean of type XXX that could not be found.相关的知识,希望对你有一定的参考价值。

报错原因:

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

解决方式:

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

 

以上是关于springboot 报错Field XXX required a bean of type XXX that could not be found.的主要内容,如果未能解决你的问题,请参考以下文章

Unknown column 'xxx' in 'field list' 报错原因

报错“Field pet in XXX.HelloController required a bean of type ‘XXX.Pet‘ that could not be found.“(代码片段

Field XXX in XXXX required a bean of type XXXX that could not be found

Property or field ‘xxx‘ cannot be found on object of type ‘Boolean‘ - maybe not public or not valid?

SpringBoot写配置文件报错“The elements [xxx,xxx] were left unbound.“

springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.