no matching bean of type found for dependency:expected at least 1 bean which qualifies as autowire c

编程入门 行业动态 更新时间:2024-10-23 11:30:40

no matching bean of <a href=https://www.elefans.com/category/jswz/34/1769883.html style=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种可能

  1. demoService类中没有添加注释,导致Service不能加入到容器中。
  2. 如果是component-scan(包扫描)的情况,需要考虑demoService是否加入到了扫描的路径下。

更多推荐

no matching bean of type found for dependency:expected at least 1 bean which qua

本文发布于:2024-03-06 07:34:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1714740.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:type   bean   matching   dependency   autowire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!