0
点赞
收藏
分享

微信扫一扫

No qualifying bean of type ‘com.xxx.xx.service.xxService‘ available: expected at leas

芷兮离离 2022-09-17 阅读 197


No qualifying bean of type ‘com.xxxx.xx.service.xxService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

出现这个问题的一个原因是:service组件没有扫描到

解决办法
修改spring-config.xml
加上下面这段就好了

<!-- 自动扫描,将类自动注册为bean,@Controller注解在spring mvc中扫描 -->
<context:component-scan base-package="com.test">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>


举报

相关推荐

0 条评论