Spring AOP config

来源:互联网 发布:仙界网络直播间好看吗 编辑:程序博客网 时间:2024/05/23 01:12
 7 <!-- 事务通知 -->   
 8     <tx:advice id="txAdvice" transaction-manager="transactionManager">   
 9         <tx:attributes>   
10             <tx:method name="add*" propagation="REQUIRED" rollback-for="Exception,SmoException,BmoException,DaoException" />   
11             <tx:method name="del*" propagation="REQUIRED" rollback-for="Exception,SmoException,BmoException,DaoException" />   
12             <tx:method name="upd*" propagation="REQUIRED" rollback-for="Exception,SmoException,BmoException,DaoException" />
13    <tx:method name="*" propagation="SUPPORTS" read-only="true" />
14   </tx:attributes>
15  </tx:advice>
16  <!-- Spring AOP config 
17  解释一下(* com.evan.crm.service.*.*(..))中几个通配符的含义:
18  第一个 * —— 通配 任意返回值类型
19  第二个 * —— 通配 包com.evan.crm.service下的任意class
20  第三个 * —— 通配 包com.evan.crm.service下的任意class的任意方法
21  第四个 .. —— 通配 方法可以有0个或多个参数

22   -->


<!--那些类的哪些方法参与事务  expression一般注入service实现类的方法参与事务 --> 

23  <aop:config>

<!--如果这里配置错了可能进行回滚,所以能看到sql语句,但是数据库是没数据的  --> 

24   <aop:pointcut id="servicesPointcut" expression="execution(* com.jstrd.mss..*SMOImpl.*(..))" />
25   <aop:advisor advice-ref="bluePrint.txAdvice" pointcut-ref="servicesPointcut" />  
26  </aop:config>
0 0
原创粉丝点击