您的位置:首页 > 编程语言 > Java开发

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

2017-08-21 10:41 896 查看
  最近在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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐