spring注入事务管理分三步
<!-- spring注入事务管理分三步 -->
<!-- 定义事务管理器-->
<bean id="txManage"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 定义拦截器-->
<bean id="txIntercept"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManage"></property>
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED, readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED, readOnly</prop>
<prop key="query*">PROPAGATION_REQUIRED, readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED, -Exception</prop>
</props>
</property>
</bean>
<!-- 拦截器的方法什么时候用-->
<bean id="autoProxy" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Service</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>txIntercept</value>
</list>
</property>
</bean>
posted on 2012-11-07 10:30 peter.peng 阅读(422) 评论(0) 编辑 收藏 举报