Error creating bean with name 'investExcelController': Injection of resource dependencies failed;

启动springboot的过程中,报以下错误:
Error creating bean with name ‘investExcelController’:Injection of resource dependencies failed;
Error creating bean with name ‘investExcelService’: Injection of resource dependencies failed;
No bean named ‘InvestTotalDao’ available
A component required a bean named ‘InvestTotalDao’ that could not be found.

错误原因:
调度平台去调用bean中的方法时,提示找不到bean。
Spring中用@Component、@Repository、@Service和 @Controller等标注的默认Bean名称会是小写开头的非限定类名
当一个组件在某个扫描过程中被自动检测到时,会根据那个扫描器的BeanNameGenerator 策略生成它的bean名称。默认情况下,任何包含 name值的Spring“典型”注解 (@Component、@Repository、 @Service和@Controller) 会把那个名字 提供给相关的bean定义。如果这个注解不包含name值或是其他检测到的组件 (比如被自定义过滤器发现的),默认bean名称生成器会返回小写开头的非限定(non-qualified)类名。

解决方法:
在service实现类中的标注名称开头小写
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_40626699/article/details/84338255