SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found.

2年前 (2022) 程序员胖胖胖虎阿
201 0 0

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


SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found.

 解决方法:

        这里报错是因为我的dao层的bean没有被spring扫到,这时候第一反应就是去看看自己的dao层是否添加对应的注解。SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found.

  如图:我的已经添加了对应的Mapper注解但是还是扫描不到,然后在自己的启动类上添加SpringBoot中A component required a bean of type ‘com.xxx.xxx.dao.PaymentDao‘ that could not be found.

@ComponentScan(basePackages = {"com.lzh.cloudstudy.dao"})

 然后就解决了这一层没法被扫到的错误。

 

相关文章

暂无评论

暂无评论...