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>
<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>
相关文章推荐
- 微信红包调用获取不到证书路径问题
- android 视图动画遇到的坑
- android studio异常
- iOS 设置导航栏背景颜色,字体颜色
- 暑期打卡——Android Studio安装总结
- android studio IntellJIDEA 快捷键 全局替换
- Android Studio中apk签名
- android java.io.NotSerializableException序列化异常
- Android Intent Action 大全
- 各种小程序:(运动员名次与谁是凶手等)
- iOS开发:Swift语言使用iconfont
- Android 中权重layout_weight
- Android 屏幕适配笔记
- Android Studio根据apk获取Sha1值
- 在android studio中,查看SHA1和MD5
- android布局与计算器app编程
- 深入浅出聊Unity3D项目优化:从Draw Calls到GC
- Android布局(LinearLayout)
- Android来电监听和去电监听
- android屏幕适配