现在的位置: 首页 > 综合 > 正文

java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0 implementing (解决)

2014年09月05日 ⁄ 综合 ⁄ 共 2077字 ⁄ 字号 评论关闭

异常信息:

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy11 implementing com.wyu.dao.ITestDao,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised'
to required type 'com.wyu.dao.TestDao' for property 'testDao'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy11 implementing com.wyu.dao.ITestDao,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]
to required type [com.wyu.dao.TestDao] for property 'testDao': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 11 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [$Proxy11 implementing com.wyu.dao.ITestDao,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required
type [com.wyu.dao.TestDao] for property 'testDao': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
... 17 more


原因:Spring在转换时,主要是将代理类转换成接口,反而不能转换成实际类。

抱歉!评论已关闭.