<!--配置声明式事务--> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="Datasource" /> </bean> <!-- 结合aop实现事务的织入--> <!--<tx:advice>配置事务通知--> <tx:advice id="txadvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="selectAll" propagation="REQUIRED"/> <tx:method name="*"></tx:method> </tx:attributes> </tx:advice> <!-- 配置事务切入--> <aop:config> <aop:pointcut id="shiwu" expression="execution(* com.itheima.Userserviceimpl.*(..))"/> <aop:advisor advice-ref="txadvice" pointcut-ref="shiwu"></aop:advisor> </aop:config>
spring事务管理
最新推荐文章于 2024-08-12 16:47:32 发布