1、execution(): 表达式主体 (必须加上execution)。
2、第一个*号:表示返回值类型,*号表示所有的类型。
3、包名:表示需要拦截的包名,后面的两个句点表示当前包和当前包的所有子包,cn.smd.service.impl包、子孙包下所有类的方法。
4、第二个*号:表示类名,*号表示所有的类。
5、*(…):最后这个星号表示方法名,*号表示所有的方法,后面括弧里面表示方法的参数,两个句点表示任何参数。
书写的注意事项:execution(* cn.smd.service.impl..(…))
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="find" propagation="SUPPORTS"/>
<tx:method name="add" propagation="REQUIRED"/>
<tx:method name="update" propagation="REQUIRED"/>
<tx:method name="del" propagation="REQUIRED"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<!-- 定义切面 -->
<aop:config proxy-target-class="true">
<aop:pointcut id="serviceMethod" expression="execution(* cn.smd.service.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"/>
</aop:config>