<?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-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="arithmeticCalculator" class="com.qst.aop.log.xml.ArithmeticCalculatorimpl"></bean>
<bean id="loggingAspect" class="com.qst.aop.log.xml.LoggingAspect"></bean>
<aop:config>
<aop:pointcut expression="execution(public int com.qst.aop.log.xml.ArithmeticCalculator.*(int, int))"
id="pointcut"/>
<aop:aspect ref="loggingAspect">
<aop:before method="beforeLog" pointcut-ref="pointcut"/>
<aop:after method="afterLog" pointcut-ref="pointcut"/>
<aop:after-returning method="afterReturningLog" pointcut-ref="pointcut" returning="result"/>
<aop:after-throwing method="afterThrowingLog" pointcut-ref="pointcut" throwing="ex"/>
</aop:aspect>
</aop:config>
</beans>
阅读之前结合AOP基于注解的日志通知阅读,切面代码在其截图