异常信息:
Spring MVC Autowired – No qualifying bean of type [] found for dependency: expected at least 1 bean which qualifies
No qualifying bean of type [...Service] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework. beans.factory.annotation.Autowired (required=true)}
说的很清楚了了,自动注入的时候,找不到对应的bean;
解决方案:
Spring MVC Autowired – No qualifying bean of type [] found for dependency: expected at least 1 bean which qualifies
No qualifying bean of type [...Service] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework. beans.factory.annotation.Autowired (required=true)}
说的很清楚了了,自动注入的时候,找不到对应的bean;
解决方案:
用eclipse的export导出时,选中那个add directory entries复选框。否则的话你导出的jar包没有目录结构,从而造成你的问题。
本文解决了一个关于SpringMVC环境下自动注入特定服务类失败的问题。主要原因是导出的jar包缺少必要的目录结构,导致Spring无法正确扫描并实例化相应的bean。解决方案是在Eclipse的导出设置中勾选“添加目录条目”,以确保正确的目录结构。
988

被折叠的 条评论
为什么被折叠?



