No qualifying bean of type [com.exe.demo01.ch1.di.UseFunctionService] is defined

1.编写功能类的Bean

2.使用功能类的Bean

3.配置类

4.运行

以上为正确的代码!

出现No qualifying bean of type [com.exe.demo01.ch1.di.UseFunctionService] is defined错误的原因如下:

1.在配置类中忘记扫描包,或扫描的包路径写错

2.在运行的main方法中,.使用AnnotationConfigApplicationContext作为Spring容器,接受输入一个配置类作为参数,这个参数配置错误

猜你喜欢

转载自blog.csdn.net/hdn_kb/article/details/82883518
今日推荐