最近在SpringBoot項目中配置事務,結果一運行出現這個異常,固然這個異常不是因爲事務引發的。web
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配置以下:spring
<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,這個時候實現類轉換失敗。app
解決方法以下:svg
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<aop:config proxy-target-class="true"></aop:config>