SSH三大框架项目运行很卡,想知道 spring事务怎么在applicationContext.xml文件中配置?
2个回答
展开全部
<aop:config>
<!-- =========== To match all business service interfaces ============== -->
<aop:pointcut id="txCommonServiceMethods" expression="execution(* com.easy.common..*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txCommonServiceMethods" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<!-- =========== 能看懂吧==entityManagerFactory与dataSource根据名字能猜到是什么吧== -->
<!-- =========== To match all business service interfaces ============== -->
<aop:pointcut id="txCommonServiceMethods" expression="execution(* com.easy.common..*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txCommonServiceMethods" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<!-- =========== 能看懂吧==entityManagerFactory与dataSource根据名字能猜到是什么吧== -->
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询