xml文件中 aop的配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.2.xsd"
xmlns:aop="http://www.springframework.org/schema/aop">



<bean id="timeHandler" class="com.example.demo01.aop.TimeHandler"/>
<bean id="videoService" class="com.example.demo01.service.impl.VideoServiceImpl"/>
<!--aop配置-->
<aop:config >

<!-- 横切关注点-->
<aop:aspect id="timeAspect" ref="timeHandler">
<!-- 定义切面表达式-->
<aop:pointcut id="allMethodLogPointCut" expression="execution(* com.example.demo01.service.VideoService.*(..))"/>
<!-- 通知前置通知和后置通知-->
<aop:before method="printBefore" pointcut-ref="allMethodLogPointCut"/>
<aop:after method="printAfter" pointcut-ref="allMethodLogPointCut"/>
</aop:aspect>

</aop:config>
</beans>
上一篇:mysql deadlock found when trying to get lock暴力解决


下一篇:DB schema的意义