1. 程式人生 > >學習筆記之aop基於IOC容器的配置(MSTzhang)

學習筆記之aop基於IOC容器的配置(MSTzhang)

<?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"
    xmlns:context="http://www.springframework.org/schema/context"
    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-3.2.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
   <bean id="atithemeticCalculator2" class="com.zhangyisheng.aopxml.AtithemeticCalculatorIMP"></bean>
   <bean id="aopCut" class="com.zhangyisheng.aopxml.AopCut"></bean>
   <aop:config>
   <aop:pointcut expression="execution(* com.zhangyisheng.aopxml.AtithemeticCalculator2.*(*,*))" id="pointcut"></aop:pointcut>
   <aop:aspect ref="aopCut" order="1">
   <aop:before method="beforeMethod" pointcut-ref="pointcut"/>
   <aop:after method="afterMethod" pointcut-ref="pointcut"/>
   <aop:after-returning method="afterReturning" pointcut-ref="pointcut" returning="result"/>
   <aop:after-throwing method="afterThrowing" pointcut-ref="pointcut" throwing="e"/>
   </aop:aspect>
   </aop:config>

</beans>