日期:2014-05-17 浏览次数:20729 次
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="dataSource"> <ref local="dataSource"/> </property> </bean> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <props> <prop key="AddOrUpdate">PROPAGATION_REQUIRED</prop> <prop key="Delete">PROPAGATION_REQUIRED</prop> <prop key="save">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="write">PROPAGATION_REQUIRED</prop> <prop key="Insert*">PROPAGATION_REQUIRED</prop> </props> </property> </bean>
<!-- 事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- 事务代理拦截器的配置 --> <bean id="baseTransactionProxy" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="transactionManager" /> </property> <property name="transactionAttributes"> <props> <prop key="AddOrUpdate">PROPAGATION_REQUIRED</prop> <prop key="Delete">PROPAGATION_REQUIRED</prop> <prop key="save">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="write">PROPAGATION_REQUIRED</prop> <prop key="Insert*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- service配置 配置事务--> <bean id="userService" parent="baseTransactionProxy"> <property name="target"> <bean class="com.test.service.UserService"> <property name="userDao"> <ref bean="userDao"/> </property> </bean> </property> </bean>