0
点赞
收藏
分享

微信扫一扫

SpringBoot整合Mybatis报错:Consider defining a bean of type ‘xx.xx.xx‘ in your configur


SpringBoot和mybatis整合完后,如果按照spring的整合习惯,可能会发现一个错误:

APPLICATION FAILED TO START

 

 

***************************

Description:

Field entFileDao in com.alibaba.serviceImpl.EntFileServiceImpl required a bean of type 'com.alibaba.dao.EntFileDao' that could not be found.

Action:

 

 

Consider defining a bean of type 'com.alibaba.dao.EntFileDao' in your configuration.

这是由于springBoot启动时,没有扫描到com.alibaba.dao.EntFileDao ,而在com.alibaba.serviceImpl.EntFileServiceImpl中又使用了@autowired private EnfileDao entFileDao进行装配,所以会发现错误,说没有定义。此时需要在springBoot的启动类上,加个注解:@MapperScan("持久层路径"),这样就会扫描到com.alibaba.dao.EntFileDao了。

完整整合步骤可参考:​​Spring Boot---(8)SpringBoot整合mybatis​​

举报

相关推荐

0 条评论