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"})

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

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐