Spring配置事物管理

<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>

你可能感兴趣的:(spring,bean,配置管理)