Spring配置事物管理

xiaoxiao2025-01-31  11

<bean id="stockMarketPriceService" parent="txProxyTemplate"> <property name="proxyInterfaces"> <list> //在service层开启事务 <value>com....com.service.StockMarketPriceService</value> </list> </property> <property name="target"><ref bean="stockMarketPriceServiceImpl"/></property> <property name="transactionAttributes"> <props> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="*">PROPAGATION_REQUIRED,-Exception</prop> </props> </property> <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="transactionManager"/> <property name="transactionAttributes"> <props> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property>  </bean>
转载请注明原文地址: https://www.6miu.com/read-5023656.html

最新回复(0)