
1 <bean id="tttt" class="com.ry.project.dataSouces.UserLogger"/> 2 <aop:config> 3 <!-- 定义一个切入点 --> 4 <aop:pointcut id="services" expression="execution (* com.ry.project.service.impl.*.*(..))" /> 5 <!-- 对切入点和事务的通知,进行适配 --> 6 <aop:aspect ref="tttt"> 7 <aop:before method="sayBefore" pointcut-ref="services"/> 8 <aop:after method="sayAfter" pointcut-ref="services"/> 9 </aop:aspect> 10 </aop:config>
* com.ry.project.service.impl.*.*(..)//这个包下所有类的所有方法
* com.ry.project.service.impl..*.*(..)//这个包及其子包所有类的所有方法
public int addUser(..)// “..”表示匹配所有参数个数和类型
public * addUser(com.ry.project.vo.Order)//表示匹配所有返回类型
public void *(com.ry.project.vo.Order)//表示匹配所有方法名
<aop:config>
<!-- 定义一个切入点 -->
<aop:pointcut id="services"
expression="execution (com.ry.project.service.impl.**(*))" />
<!-- 对切入点和事务的通知,进行适配 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="services" />
</aop:config>
advisor一搬用于事务AOP aspect用于面向编程AOP
来源:https://www.cnblogs.com/wangbiaohistory/p/12546242.html
