SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found.
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-29 22:52:35.557 ERROR [cloud-payment-service,,,] 13720 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.xxx.xxx.dao.PaymentDao' that could not be found.
Action:
Consider defining a bean of type 'com.xxx.xxx.dao.PaymentDao' in your configuration.
Process finished with exit code 0
解决方法:
这里报错是因为我的dao层的bean没有被spring扫到,这时候第一反应就是去看看自己的dao层是否添加对应的注解。
如图:我的已经添加了对应的Mapper注解但是还是扫描不到,然后在自己的启动类上添加
@ComponentScan(basePackages = {"com.lzh.cloudstudy.dao"})
然后就解决了这一层没法被扫到的错误。
版权声明:程序员胖胖胖虎阿 发表于 2022年10月11日 下午3:40。
转载请注明:SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found. | 胖虎的工具箱-编程导航
转载请注明:SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found. | 胖虎的工具箱-编程导航
相关文章
暂无评论...