Spring AOP编程-传统基于aspectJ切点AOP开发

1、在配置文件上方增加aop相关配置。
2、在spring的配置文件中定义目标与通知.
3、使用aop:xxx标签来完成切面与切点声明。
4、我们使用aspectj的切面声明方式 需要在导入aspectj的jar包.

这里写图片描述


<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.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"><bean id="orderService" class="cn.nwtxxb.aop.OrderServiceImpl">bean><bean id="orderServiceAdvice" class="cn.nwtxxb.aop.OrderHelper">bean><aop:config><aop:pointcut expression="execution(* cn.nwtxxb.aop.IOrderService.*(..))"id="orderServicePointCut" /><aop:advisor advice-ref="orderServiceAdvice" pointcut-ref="orderServicePointCut" />aop:config>
beans> 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部