1.描述:
小资 ,在ssh 框架,配置声明事物管理后,启动Tomcat 报错!!!
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0 implementing service.EmployeeService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [service.impl.EmployeeServiceImpl] for property 'employeeServiceImpl'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0 implementing service.EmployeeService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [service.impl.EmployeeServiceImpl] for property 'employeeServiceImpl': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
2.application.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<!-- 配置Hibernate的管理实务 -->
<bean id= "txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id ="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="search*" read-only="true"/>
<tx:method name="query*" read-only="true"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="do*" propagation="REQUIRED"/>
<tx:method name="*" read-only = "true"/>
</tx:attributes>
</tx:advice>
<!-- aop -->
<aop:config>
<aop:pointcut id = "serviceMethod" expression = "execution(* service.impl.*.*(..))"></aop:pointcut>
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"></aop:advisor>
</aop:config>
<bean id= "userDao" class="dao.impl.EmployeeOperimpl">
<property name="sessionFactory" ref= "sessionFactory"></property>
</bean>
<bean id = "userBiz" class="service.impl.EmployeeServiceImpl">
<property name="employeeDao" ref="userDao"></property>
</bean>
<bean id = "userAction" class= "web.action.userAction">
<property name="employeeServiceImpl" ref="userBiz"/>
</bean>
</beans>
3.业务层
ssh tomcat