标签:beans top lin ret org line expr int work
AspectJ来通过xml配置实现可以通过参考查看下面的代码:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!--开启aspectJ的注解开发,AspectJ的自动代理--> <!--<aop:aspectj-autoproxy/>--> <!--目标类--> <bean id="xiaomao" class="com.AspecJ.xiaomaoDao"></bean> <!--切面类--> <bean id="AspecJ" class="com.AspecJ.aspectj"/> <!--通过xml配置--> <aop:config> <!--配置切点--> <aop:pointcut id="Mypointcut" expression="execution(* com.AspecJ.xiaomaoDao.find())"/> <aop:pointcut id="Mypointcut2" expression="execution(* com.AspecJ.xiaomaoDao.update())"/> <!--配置切面类和通知--> <aop:aspect id="aspectj" ref="AspecJ"> <aop:before method="before" pointcut-ref="Mypointcut"/> <aop:after-returning method="after" pointcut-ref="Mypointcut2"/> </aop:aspect> </aop:config> </beans>
标签:beans top lin ret org line expr int work
原文地址:https://www.cnblogs.com/xiaolaha/p/11380211.html