org.springframework.beans.ConversionNotSupportedException异常解决方法
2017-08-21 10:41
896 查看
最近在SpringBoot项目中配置事务,结果一运行出现这个异常,当然这个异常不是由于事务引起的。
Spring beans.xml配置如下:
rfqFileUpload bean的传入参数rfqService,而这个bean是RfqService接口的实现类RfqServiceImpl,这个时候实现类转换失败。
解决方法如下:
1、添加aop依赖
1、applicationContext.xml文件中配置aop,注明可以用实现类注入。
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>
相关文章推荐
- nested exception is org.springframework.beans.ConversionNotSupportedException的解决方法
- java异常:org.springframework.beans.ConversionNotSupportedException
- spring异常解决方法:org.springframework.beans.factory.BeanCreationNotAllowedException
- SSM 运行时发生异常:org.springframework.beans.ConversionNotSupportedException:
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
- Spring+mybatis+SpringMVC整合发生异常:org.springframework.beans.ConversionNotSupportedException
- org.springframework.beans.ConversionNotSupportedException
- org.springframework.beans.factory.NoSuchBeanDefinitionException 异常解决方法
- org.springframework.beans.ConversionNotSupportedException:
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedExcept
- org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.la
- 解决[BlazeDS]Error deserializing client message. org.springframework.beans.ConversionNotSupportedExcep
- 出现 org.springframework.beans.factory.BeanCreationException 异常的原因及解决方法
- 在Spring Cloud框架整合微服务时出现的org.springframework.web.HttpMediaTypeNotSupportedException异常问题
- org.springframework.core.task.TaskRejectedException:Executor[]did not accept task异常解决
- org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported解决!
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name的解决方法
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL问题解决方法
- 【问题解决】 web项目启动不了 org.springframework.beans.factory.BeanCreationException: Could not autowire field:
- maven项目启动报:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 错误解决方法-杜恩德