Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常

这个异常是由于在applicationContext.xml中关于bean的autowirte装配类型,在类型byName,byType,constructor三种类型中,可能会出现因无法自动装配而产生题目中的异常。

下面介绍一下关于autowrite的集中装配类型:

1)no:采用自动装配。必须使用ref直接饮用其他Bean<ref bean="JavaBean"/>

2)byName:以属性名区分自动装配。在容器中寻找与JavaBean属性名相同的JavaBean,并假期自动装配到JavaBean中。

3)byType:以属性类型区分自动转配

4)constructor:通过构造方法的参数类型自动装配

5)autudetect:首先使用constructor方式自动装配,然后使用byType方式

在使用自动装配的时候,吧容易出现问题的JavaBean采用手动装配。

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-30 07:37:53

Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常的相关文章

关于Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常

这个异常是由于在applicationContext.xml中关于bean的autowirte装配类型,在类型byName,byType,constructor三种类型中,可能会出现因无法自动装配而产生题目中的异常. 下面介绍一下关于autowrite的集中装配类型: 1)no:采用自动装配.必须使用ref直接饮用其他Bean<ref bean="JavaBean"/> 2)byName:以属性名区分自动装配.在容器中寻找与JavaBean属性名相同的JavaBean,并假

启动项目报错:org.springframework.beans.factory.UnsatisfiedDependencyException

dubbo项目: 启动项目报错:(web端) org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.facto

SSM整合报错org.springframework.beans.factory.UnsatisfiedDependencyException

我解决的办法是把.m2仓库所有文件删除,重新maven project就可以了. 但是在做这一步之前,报错如下: ①org.springframework.beans.factory.UnsatisfiedDependencyException ②ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Sta

【实战问题】【14】org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;xxMapper&#39;

问题: SpringBoot启动时报错: Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException:Error creating bean with name 'userDaoMapper' defined in file [E:\WebProject\... 解决方案: pom.xml文件引入了两个Mybatis依赖包.一个是整合SpringBoot的,一个是整合Spring的jar包.两个一

org.springframework.beans.factory.UnsatisfiedDependencyException 问题

在用mybatis-plus生成代码的时候,生成代码后,springboot项目启动不了,总是这样的错误: org.springframework.beans.factory.UnsatisfiedDependencyException  XXX No qualifying bean of type 'com.springboot.modules.myuser.mapper.MyuserMapper'' XXX 看了网上很多的方法,大概有几种: 1>>springboot的启动文件要放在合适的

org.springframework.beans.factory.BeanDefinitionStoreException异常

1.下面是我遇到的异常信息: 2017-03-25 18:01:11,322 [localhost-startStop-1] [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'da

org.springframework.beans.factory.UnsatisfiedDepen

这个异常在网上找了好多办法,什么防火墙啊之类的,最后发现是启动顺序问题,先启动服务提供者,再启动消费者就好了,不然找不到服务就会报这个错误 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managerItemCatServiceImpl': Unsatisfied dependency expressed through field 'itemCat

@Repository 注解引发的异常: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field

手头的项目使用spring mvc+ mybatis框架开发,今天调试时遇到奇怪的问题, biz层的ManagerImpl.java 一直报错: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field.... 逐一检查了Dao层.biz层.service层的文件,

Spring AOP基于注解的“零配置”方式---org.springframework.beans.factory.BeanNotOfRequiredTypeException

具体异常信息如下: 1 Exception in thread "main" org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'hello' must be of type [com.hyq.chapter08_04_3.HelloImpl], but was actually of type [com.sun.proxy.$Proxy13] 2 at org.springfram