org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

问题描述

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘xxxxx.UserService‘ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Description:

Field userService in com.atguigu.gmall.user.controller.UserController required a bean of type ‘xxxx.service.UserService‘ that could not be found.

Action:

Consider defining a bean of type ‘xxxx.service.UserService‘ in your configuration.

解决方案 :

  1. 根据报错, 将UserService的注解@Autowired 修改为 @Autowired(required=true)  ===> 无效

  2. 由于整合了dubbo, 修改UserService的注解为@Reference

原文地址:https://www.cnblogs.com/chenxi-mxj/p/12171870.html

时间: 2024-10-24 13:31:23

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}的相关文章

spring Boot异步操作报错误: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.self.spring.springboot.Jeep' available

我也是最近开始学习Spring Boot,在执行异步操作的时候总是汇报如下的错误: Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.self.spring.springboot.Jeep' available at org.springframework.beans.factory.sup

添加事务后 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type available

今天遇到了一个奇怪的问题   在没添加事务之前  所有的代码都是好的 , 当我添加了事务之后, 代码报错 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type available ApplicationContext: <!-- 配置事务 --> <bean id="transactionManager" class="org.s

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [dx.service.ItemService] found for dependency

在整合ssm框架,测试service层的时候报错 Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [dx.service.ItemService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dep

org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type &#39;xxx &#39;available

搭了一个简单的SSM项目,启动报错: org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'com.xxx.ssmdemo.service.IUserService' available: expected at least 1 bean which qualifies as autowire candidate.Dependency annotations: {@o

springboot 报错 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type &#39;com.example.service.HrService&#39; available: 有没有大佬出个主意,我找了一天,刚入门springboot

话不多说先上图,这是启动类的配置,这里配置了@ComponentScan("我的mapper的接口") 接下来是我的项目结构截图 然后是service 的截图,我在这里加了注解@Service 最后我在测试类里面 的截图 最后附上我的maven的pom 我开始怀疑是这个配置的有问题了 <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.a

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut

spring中一个符号的错误居然让我浪费了四五个小时才找出来,不得不给自己了两个耳光.. 由于新建项目与原来项目的目录结构有所不同,copy过来的配置文件,有些地方修改的不彻底,导致spring扫描注解的时候,扫描不到,不能注入bean,导致运行出错.一个马虎浪费了这么多时间,符号这种问题也往往最容易忽视的.<context:component-scan base-package="com.oskyhang.*.service"/> <context:componen

{@org.springframework.beans.factory.annotation.Autowired(required=true)}

出现这个问题的时候 , 我试图调用spring注入一个service @autowired private XxxService xxxService; 但是 , 没有在该service中加@Service的标签. 自动注入的时候,找不到对应的bean,因对应要注入的实现类没有加注解,DAO层用 @Repository ,Service层用 @Service

Spring Task Scheduler - No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined

1. Overview In this article, we are discussing the Springorg.springframework.beans.factory.NoSuchBeanDefinitionException – this is a common exception thrown by the BeanFactory when trying to resolve a bean that simply isn’t defined in the Spring Cont

spring异步执行报异常No qualifying bean of type &#39;org.springframework.core.task.TaskExecutor&#39; available

最近观察项目运行日志的时候突然发现了一个异常, [2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG org.springframework.scheduling.annotation.AnnotationAsyncExecutionInterceptor---- Could not find default TaskExecutor bean org.springframework.beans.factory.NoSuchBe