<!-- 在spring中声明事务的配置 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="jdbcDataSource" />
</bean>
<!-- 事务增强的配置 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 事务属性的配置,配置都哪些方法上 -->
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="add*" rollback-for="Exception"/>
<tx:method name="remove*" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceCut" expression="execution(public * com.gxa.bj.service.*.*(..))" />
<aop:advisor pointcut-ref="serviceCut" advice-ref="txAdvice" />
</aop:config>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="jdbcDataSource" />
</bean>
<!-- 事务增强的配置 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 事务属性的配置,配置都哪些方法上 -->
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="add*" rollback-for="Exception"/>
<tx:method name="remove*" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceCut" expression="execution(public * com.gxa.bj.service.*.*(..))" />
<aop:advisor pointcut-ref="serviceCut" advice-ref="txAdvice" />
</aop:config>