简化spring中的事务管理配置
<!-- Transactional proxy for the services -->
<bean id="baseTxProxy" lazy-init="true" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="do*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="itemService" parent="baseTxProxy">
<property name="target">
<bean class="ItemServiceImpl" autowire="byName"/>
</property>
</bean>
这样省事情多了,不用为每个bean都配置事务了.
<bean id="baseTxProxy" lazy-init="true" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="do*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="itemService" parent="baseTxProxy">
<property name="target">
<bean class="ItemServiceImpl" autowire="byName"/>
</property>
</bean>
这样省事情多了,不用为每个bean都配置事务了.
浙公网安备 33010602011771号