面向切面spring-aop.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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd" >
<aop:aspectj-autoproxy/>
<!--使用cglib代理,如果不开启的话默认是jdk的代理,导致controller中的方法不被拦截-->
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!--
<bean id="personService"></bean>
–>
<bean id="inteceptorXML" class="com.uplooking.club.vip.service.aop.PayServiceAopUtil" />
<aop:config>
<aop:aspect id="aspectd" ref="inteceptorXML">
<aop:pointcut id="myPointCutMethod" expression="execution(*
com.uplooking.club.vip.service.VipService.insert*(..))" />
<!--
<aop:before pointcut-ref="myPointCutMethod" method="paybefore"/>
<aop:after pointcut-ref="myPointCutMethod" method="payafter"/>
–>
<aop:around pointcut-ref="myPointCutMethod" method="payExprice"/>
<!--
<aop:after-returning pointcut-ref="myPointCutMethod" method="doWriteLog"/>
<aop:after-throwing pointcut-ref="myPointCutMethod" method="doWriteErrorLog"/>
<aop:after pointcut-ref="myPointCutMethod" method="doMemoryClear"/>
<aop:around pointcut-ref="myPointCutMethod" method="doAroundMethod"/>
–>
</aop:aspect>
</aop:config>
</beans>