配置事物管理器
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="mySessionFactory"/>
</property>
</bean>
配置事务的传播性
<tx:advice id=''nameadvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name ="save" propagtion="required">
</tx:attributes>
</tx:advice>
配置参与事务的类
<aop:config>
指扫描expression下的类
<aop:pointcut id ="namePointcut" expression“execution(* com.test.testAda.test.model.service.*.*(..)))”>
<aop:advisor pointcut-ref="namePointcut" advice-ref="nameadvice"
expression=“execution(* com.test.testAda.test.model.service..(…))”
其中第一个*代表返回值,第二*代表service下子包,第三个*代表方法名,“(..)”代表方法参数