no matching editors or conversion strategy
时间:2008-06-28 来源:zuzhiyang
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy1] to required type
[com.brilliance.struts.service.impl.InvestServiceImpl] for property 'fundService'; nested exception is
java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy1] to required type
[com.brilliance.struts.service.impl.InvestServiceImpl] for property 'fundService': no matching editors or conversion strategy
found
在spring事务时会出现。
解决办法是:
在事务中加上下面语句
<property name="proxyTargetClass" >
<value>true</value>
</property>
表面proxy代理的是类而不是接口。
下面是我的事务配置:
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="transactionAttributeSource"
class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<props>
<prop key="*">PROPAGATION_REQUIRED, -Exeptions</prop>
</props>
</property>
</bean>
<bean id="abstractTxDefinition"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
lazy-init="true">
<property name="proxyTargetClass" >
<value>true</value>
</property>
<property name="transactionManager">
<ref bean="transactionManager"></ref>
</property>
<property name="transactionAttributeSource">
<ref bean="transactionAttributeSource"></ref>
</property>
</bean>
<bean id="fundService1" parent="abstractTxDefinition">
<property name="target">
<ref bean="FundService"></ref>
</property>
</bean>
..............
<bean name="/updateFund"
class="com.brilliance.struts.action.UpdateFundAction">
<property name="fundService">
<ref local="fundService1" />
</property>
</bean>