org.springframework.beans.ConversionNotSupportedException异常解决方法

29 篇文章 1 订阅
12 篇文章 1 订阅

  最近在SpringBoot项目中配置事务,结果一运行出现这个异常,当然这个异常不是由于事务引起的。

org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy54 implementing com.loongshawn.service.RfqService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised

这里写图片描述

  Spring beans.xml配置如下:

    <bean id="readExcel" class="com.loongshawn.method.pms.ReadExcel"/>

    <bean id="rfqService" class="com.loongshawn.service.impl.RfqServiceImpl"/>

    <bean id="rfqSourceFileValidService" class="com.loongshawn.service.impl.RfqSourceFileValidServiceImpl"/>

    <bean id="rfqFileUpload" class="com.loongshawn.method.pms.RfqFileUpload">
        <property name="readExcel" ref="readExcel"/>
        <property name="rfqService" ref="rfqService"/>
        <property name="rfqSourceFileValidService" ref="rfqSourceFileValidService"/>
    </bean>

  rfqFileUpload bean的传入参数rfqService,而这个bean是RfqService接口的实现类RfqServiceImpl,这个时候实现类转换失败。

  解决方法如下:

  • 1、添加aop依赖
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-aop</artifactId>
</dependency>
  • 1、applicationContext.xml文件中配置aop,注明可以用实现类注入。
<aop:config proxy-target-class="true"></aop:config>
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值