错误:Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'iCustome
2019-05-29 15:56
1646 查看
4000
Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ’ iCustomerService ’ is expected to be of type ’ service.ICustomerServiceImpl ’ but was actually of type ‘com.sun.proxy.$Proxy13’
原因分析:
spring默认使用jdk方式创建代理对象,而不是cglib方式
二者区别主要在于,jdk方式只能代理接口实现类,cglib既可以代理接口实现类又可以代理一般类
ICustomerServiceImpl经过代理之后变成了iCustomerService接口类型
方案一:使用cglib代理方式,配置文件
<aop:config proxy-target-class=“true”>
方案二:使用接口类型调用方法
iCustomerService.service();
方案三:不做增强
相关文章推荐
- org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named "" must be of type [org.apache.struts.action.Action
- org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'faceAction' must be of
- Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'dao' is exp
- "org.springframework.beans.factory.BeanNotOfRequiredTypeException……" 错误解决方案
- org.springframework.beans.factory.BeanNotOfRequiredTypeException 错误,
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [
- 运用spring时出现org.springframework.beans.factory.BeanNotOfRequiredTypeException: 错误
- org.springframework.beans.factory.BeanNotOfRequiredTypeException的解决办法
- org.springframework.beans.factory.BeanNotOfRequiredTypeException:
- 在使用Spring AOP 时,启动服务抛出异常: org.springframework.beans.factory.BeanNotOfRequiredTypeException
- 处理异常:org.springframework.beans.factory.BeanNotOfRequiredTypeException
- org.springframework.beans.factory.BeanNotOfRequiredTypeException
- Spring-org.springframework.beans.factory.BeanNotOfRequiredTypeException
- 解决: org.springframework.beans.factory.BeanNotOfRequiredTypeException
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'http://10
- org.springframework.beans.factory.BeanNotOfRequiredTypeException must be of type
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of ty
- 代理及注入之org.springframework.beans.factory.BeanNotOfRequiredTypeException
- org.springframework.beans.factory.BeanNotOfRequiredTypeException:
- Aurora-hec4.0_scaninvoice_异常_04_org.springframework.beans.factory.BeanNotOfRequiredTypeException