type found for dependency:expected at least 1 bean which qualifies as autowire c"/>
no matching bean of type found for dependency:expected at least 1 bean which qualifies as autowire c
Error creating bean with name ‘demoService’: Injection of resource
dependencies failed; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
matching bean of type [swust.seclab.domain.Role] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for
this dependency. Dependency annotations:
{@javax.annotation.Resource(shareable=true, mappedName=, description=,
name=, type=class java.lang.Object, authenticationType=CONTAINER)}
说明demoService没有加入到Spring的容器中,目前想到的有2种可能
- demoService类中没有添加注释,导致Service不能加入到容器中。
- 如果是component-scan(包扫描)的情况,需要考虑demoService是否加入到了扫描的路径下。
更多推荐
no matching bean of type found for dependency:expected at least 1 bean which qua
发布评论