您的位置:首页 > 移动开发

AOP切面编程applicationContext.xml的配置

2016-07-07 19:56 411 查看
<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <!-- 配置切面类 -->
<bean id="zhuangbeibean" class="com.gxa.bj.aspect.ZhuangBei"/>
<!-- 配置目标对象类 -->
<bean id="zhangsan" class="com.gxa.bj.service.ZhangSanRole"/>
<bean id="lisi" class="com.gxa.bj.service.LiSiRole"/>
<!-- 配置AOP增强 -->
<aop:config>
<aop:aspect id="zhuangbeiaspect" ref="zhuangbeibean">
<!-- 配置切入点,切入点要满足表达式 -->
<aop:pointcut expression="execution(* com.gxa.bj.service.*.*(..))" id="pointcut"/>
<!-- 要织入增强方法的匹配 -->
<aop:before method="before" pointcut-ref="pointcut"/>
<aop:around method="around" pointcut-ref="pointcut"/>
<aop:after method="after" pointcut-ref="pointcut"/>
</aop:aspect>
</aop:config>

</beans>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: