当前位置: 代码迷 >> Java Web开发 >> spring注解式事务加在方法下失败,求人指点
  详细解决方案

spring注解式事务加在方法下失败,求人指点

热度:2967   发布时间:2013-02-25 21:12:14.0
spring注解式事务加在方法上失败,求人指点!
在service方法上加入了
@Transactional(readOnly = false, propagation = Propagation.REQUIRED,rollbackFor=Exception.class) 
使得方法加载不到了。。不知道是少哪里原因,以下spring配置文件

Java code
<beans    xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns:context="http://www.springframework.org/schema/context"     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/context       http://www.springframework.org/schema/context/spring-context-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">        <context:annotation-config /><bean id="dataSource"        class="org.apache.commons.dbcp.BasicDataSource">        <property name="driverClassName" value="${jdbc.driverClassName}"></property>        <property name="url" value="${jdbc.url}"></property>        <property name="username" value="${jdbc.username}"></property>        <property name="password" value="${jdbc.password}"></property>         <property name="maxActive">                <value>100</value>          </property>          <property name="maxWait">              <value>1000</value>          </property>          <property name="maxIdle">             <value>30</value>          </property>          <property name="defaultAutoCommit">             <value>true</value>             </property>          <property name="removeAbandoned">             <value>true</value>            </property>          <property name="removeAbandonedTimeout">              <value>60</value>            </property>    </bean><bean id="sessionFactory"        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">        <property name="dataSource">            <ref bean="dataSource" />        </property>        <property name="hibernateProperties">            <props>                <prop key="hibernate.dialect">                    org.hibernate.dialect.Oracle9Dialect                </prop>                <prop key="hibernate.show_sql">true</prop>                <prop key="hibernate.format_sql">true</prop>            </props>        </property></bean>        <!-- 事务管理对象-->    <bean id="transactionManager"         class="org.springframework.orm.hibernate3.HibernateTransactionManager">        <property name="sessionFactory">            <ref local="sessionFactory"/>        </property>    </bean><tx:annotation-driven transaction-manager="transactionManager" /><bean id="TCashaccountDAO"        class="com.skyTeam.junjunxia.user.dao.TCashaccountDAO">        <property name="sessionFactory">            <ref bean="sessionFactory" />        </property>    </bean></beans>



另外工程中引入的spring包有
  相关解决方案