Spring Boot Junit启动报错:springboot启动报错:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualif…

Spring Boot项目的Junit中变量提示无法自动装配

运行报错:

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

解决:

在测试类上加上组建扫描Annation
大T笔记所有文章均为本人原创,转载请您注明来源,并留下原文链接地址,是对我的尊重,也是对知识的尊重,谢谢!
大T笔记 » Spring Boot Junit启动报错:springboot启动报错:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualif…

大T笔记-我的个人互联网创业和自由职业之路

关于我 我的百宝箱
大T笔记-专注个人互联网创业和自由职业