SpringAOP配置事务

来源:互联网 发布:诸暨行知小学陈舟燕 编辑:程序博客网 时间:2024/06/06 20:59
<!-- 事务管理 -->      <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">           <property name="sessionFactory" ref="sessionFactory"></property>      </bean>           <!-- 事务通知 -->      <tx:advice id="txAdvice" transaction-manager="transactionManager">          <tx:attributes>              <tx:method name="get*" read-only="true"/>              <tx:method name="*" propagation="REQUIRES_NEW" rollback-for="Exception"/>         <!--  REQUIRES_NEW 的含义:不管怎样都新建一个事务,如果有事务,原来事务挂起 -->      </tx:attributes>      </tx:advice>           <!-- aop代理设置 -->      <aop:config proxy-target-class="true">          <aop:pointcut id="txPointcut" expression="execution(* com.bluesky.service.*Service.*(..))"/>           <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />           </aop:config>


 

原创粉丝点击