Schema-based AOP support

本文参考至:spring-framework-reference.pdf的7.3 章节

【Schema-based AOP support】

  If you are unable to use Java 5, or simply prefer an XML-based format, then Spring 2.0 also offers
support for defining aspects using the new "aop" namespace tags. The exact same pointcut expressions
and advice kinds are supported as when using the @AspectJ style, hence in this section we will focus on
the new syntax and refer the reader to the discussion in the previous section (Section 7.2, “@AspectJ
support”) for an understanding of writing pointcut expressions and the binding of advice parameters.

  To use the aop namespace tags described in this section, you need to import the spring-aop schema as
described in Appendix C, XML Schema-based configuration. See the section called “The aop schema” for
how to import the tags in the aop namespace.

  Within your Spring configurations, all aspect and advisor elements must be placed within an
<aop:config> element (you can have more than one <aop:config> element in an application
context configuration). An <aop:config> element can contain pointcut, advisor, and aspect elements
(note these must be declared in that order).

  如果,你不能使用java5,或者更倾向于使用XML格式的配置文件,Spring2.0引入了支持使用配置文件配置Aop,使用【aop】的命名空间,相同的pointCut表

答式和各种advice(before、after、around、after returning)也可以像@AspectJ中一样的使用。因而在本节中,我们将主要介绍新的语义,并且涉及到

前面的章节,更好的理解如何编写pointCut表达式和绑定advice的参数。

  要使用在本节使用aop的命名空间标签,需要参考附录C引入spring-aop的schema即-XML Schema-based configuration。

     在自己的Spring配置文件中,所有的aspect和advisor标签必须至于<aop:config>标签范围内【在一个配置文件中,可以有多个<aop:config>标签】,一个

【<aop:config>】标签可以包含point、advisor、和asect元素,特别强调:元素的命名,必须要按照上述的顺序

  

转载于:https://www.cnblogs.com/caroline/p/4251827.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值