论坛首页 Java企业应用论坛

Aop的几个术语

浏览 10095 次
该帖已经被评为精华帖
作者 正文
   发表时间:2004-04-18  
从Spring文档来的,清楚定义了几个aop的术语,因为aop这些术语并不直观,所以专门列出来备查。
• Aspect: A modularization of a concern for which the implementation might otherwise cut across multiple
objects. Transaction management is a good example of a crosscutting concern in J2EE applications. Aspects
are implemented using Spring as Advisors or interceptors.
• Joinpoint: Point during the execution of a program, such as a method invocation or a particular exception
being thrown.
• Advice: Action taken by the AOP framework at a particular joinpoint. Different types of advice include
"around," "before" and "throws" advice. Advice types are discussed below. Many AOP frameworks,
including Spring, model an advice as an interceptor, maintaining a chain of interceptors "around" the
joinpoint.
• Pointcut: A set of joinpoints specifying when an advice should fire. An AOP framework must allow
developers to specify pointcuts: for example, using regular expressions.

• Introduction: Adding methods or fields to an advised class. Spring allows you to introduce new interfaces
to any advised object. For example, you could use an introduction to make any object implement an
IsModified interface, to simplify caching.
• Target object: Object containing the joinpoint. Also referred to as advised or proxied object.
• AOP proxy: Object created by the AOP framework, including advice. In Spring, an AOP proxy will be a
JDK dynamic proxy or a CGLIB proxy.
• Weaving: Assembling aspects to create an advised object. This can be done at compile time (using the
AspectJ compiler, for example), or at runtime. Spring, like other pure Java AOP frameworks, performs
weaving at runtime.
   发表时间:2004-04-18  
感谢femto! femto是个好人。^_^
0 请登录后投票
   发表时间:2006-03-06  
问一个困惑已久的问题,"Advice"和"Interceptor"是一个概念吗?
为什么在Spring里面,经常混淆这两个概念?
0 请登录后投票
   发表时间:2006-03-08  
补上两点:
引用
• Weaving: This is the process of actually inserting aspects into the application code at the appropriate point. For compile-time AOP solutions, this is, unsurprisingly, done at compile time, usually as an extra step in the build process. Likewise, for runtime AOP solutions, the weaving process is executed dynamically at runtime.


引用
• Target: An object whose execution flow is modified by some AOP process is referred to as the target object. Often you see the target object referred to as the advised object.
0 请登录后投票
   发表时间:2006-03-13  
这几个术语的定义和aspectj中定义的是一致的吧
0 请登录后投票
   发表时间:2006-03-21  
dazuiba 写道
问一个困惑已久的问题,"Advice"和"Interceptor"是一个概念吗?
为什么在Spring里面,经常混淆这两个概念?

advice可以是around after before throw等
interceptor会使用不同的advice

引用
An action taken at a particular join point. Different types of advice in Spring
include around, before, throws and after returning. Of these, around is the
most powerful, as you get the opportunity to do something before and after a
method is invoked. The previous TraceInterceptor used around advice
by implementing the AOP Alliance's MethodInterceptor. You can use the
other advice types by implementing the following Spring Interfaces:
ƒ MethodBeforeAdvice
ƒ ThrowsAdvice
ƒ AfterReturningAdvice
0 请登录后投票
   发表时间:2006-03-21  
dazuiba 写道
问一个困惑已久的问题,"Advice"和"Interceptor"是一个概念吗?
为什么在Spring里面,经常混淆这两个概念?

interceptor会是不同类型的advice
advice
引用
An action taken at a particular join point. Different types of advice in Spring
include around, before, throws and after returning. Of these, around is the
most powerful, as you get the opportunity to do something before and after a
method is invoked. The previous TraceInterceptor used around advice
by implementing the AOP Alliance's MethodInterceptor. You can use the
other advice types by implementing the following Spring Interfaces:
ƒ MethodBeforeAdvice
ƒ ThrowsAdvice
ƒ AfterReturningAdvice

Interceptor
引用
An AOP implementation strategy, where a chain of interceptors may exist for
a particular join point.
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics