一、

1.Advice

Advice是切面的要做的操作,它定义了what、when(什么时候要做什么事)

aspects have a purpose—a job they’re meant to do. In AOP terms, the job
of an aspect is called advice.
Advice defines both the what and the when of an aspect. In addition to describing
the job that an aspect will perform, advice addresses the question of when to perform

the job. Should it be applied before a method is invoked? After the method is
invoked? Both before and after method invocation? Or should it be applied only if a
method throws an exception?
Spring aspects can work with five kinds of advice:
 Before—The advice functionality takes place before the advised method is
invoked.
 After—The advice functionality takes place after the advised method completes,
regardless of the outcome.
 After-returning—The advice functionality takes place after the advised method
successfully completes.
 After-throwing—The advice functionality takes place after the advised method
throws an exception.
 Around—The advice wraps the advised method, providing some functionality
before and after the advised method is invoked.

2.JOIN POINTS

一个应用程序可以有无数的点可以织入aspect,这些点就是连接点。一个连接点是描述当应用程序执行什么操作时要织入aspect。这个时机可以一个方法的被调用、抛出异常,甚至是一个类的成员变量被修改时。

The join points are all the points within the execution flow of the application that are candidates to have advice applied.

3.POINTCUTS

大多数情况下,并非所有连接点都需要aop,Pointcut就是用来缩小需要aop的连接点范围。如果说一个advice描述了切面的what和when问题,那么Pointcut就是描述了切面的where问题。A pointcut definition matches one or more join points at which advice should be woven。通常Pointcut用类名及方法名或表达式来定义。

The pointcut defines where (at what join points) that advice is applied. The key concept you should take from this is that pointcuts define which join points get advised.

4.Aspect

aspect是advice和pointcut的组合。

An aspect is the merger of advice and pointcuts. Taken together, advice and pointcuts define everything there is to know about an aspect—what it does and where and when it does it.

5.INTRODUCTIONS

An introduction allows you to add new methods or attributes to existing classes.比如在一个类中增加一个维护状态值的功能

6.Weaving

Weaving is the process of applying aspects to a target object to create a new proxied object. The aspects are woven into the target object at the specified join points. The weaving can take place at several points in the target object’s lifetime:
 Compile time—Aspects are woven in when the target class is compiled. This
requires a special compiler. AspectJ’s weaving compiler weaves aspects this way.
 Class load time—Aspects are woven in when the target class is loaded into the
JVM . This requires a special ClassLoader that enhances the target class’s byte-
code before the class is introduced into the application. AspectJ 5’s load-time
weaving ( LTW ) support weaves aspects this way.
 Runtime—Aspects are woven in sometime during the execution of the applica-
tion. Typically, an AOP container dynamically generates a proxy object that del-
egates to the target object while weaving in the aspects. This is how Spring AOP aspects are woven.

SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-002-AOP术语解析的更多相关文章

  1. SPRING IN ACTION 第4版笔记-第四章Aspect-oriented Spring-001-什么是AOP

    一. Aspect就是把会在应用中的不同地方重复出现的非业务功能的模块化,比如日志.事务.安全.缓存 In software development, functions that span mult ...

  2. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-010-Introduction为类增加新方法@DeclareParents、<aop:declare-parents>

    一. 1.Introduction的作用是给类动态的增加方法 When Spring discovers a bean annotated with @Aspect , it will automat ...

  3. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-003-Spring对AOP支持情况的介绍

    一. 不同的Aop框架在支持aspect何时.如何织入到目标中是不一样的.如AspectJ和Jboss支持在构造函数和field被修改时织入,但spring不支持,spring只支持一般method的 ...

  4. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-005-定义切面使用@Aspect、@EnableAspectJAutoProxy、<aop:aspectj-autoproxy>

    一. 假设有如下情况,有一个演凑者和一批观众,要实现在演凑者的演凑方法前织入观众的"坐下"."关手机方法",在演凑结束后,如果成功,则织入观众"鼓掌& ...

  5. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-004-使用AspectJ’s pointcut expression language定义Pointcut

    一. 1.在Spring中,pointcut是通过AspectJ’s pointcut expression language来定义的,但spring只支持它的一部分,如果超出范围就会报Illegal ...

  6. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-012-AOP总结

    1.AOP是面向对象编程的有力补充,它可以让你把分散在应用中的公共辅助功能抽取成模块,以灵活配置,减少了重复代码,让类更关注于自身的功能

  7. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-011-注入AspectJ Aspect

    一. 1. package concert; public interface CriticismEngine { public String getCriticism(); } 2. package ...

  8. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-009-带参数的ADVICE2 配置文件为XML

    一. 1.配置文件为xml时则切面类不用写aop的anotation package com.springinaction.springidol; public class Magician impl ...

  9. SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-009-带参数的ADVICE2

    一. 情景:有个魔术师会读心术,常人一想一事物他就能读到.以魔术师为切面织入常人的内心. 二. 1. // <start id="mindreader_java" /> ...

随机推荐

  1. Unity3d不支持vistual studio2012?用vs2012打开unity c#脚本进行编码的方法。

    unity3d是支持vs2010的,但是有很多开发者反应,unity3d中的C#脚本不能用vs2012打开.我想了一下,先进入存放C#脚本的目录,在设置里面C#文件的打开方式,选择用vs2012打开, ...

  2. dagger和butterknife使用冲突

    两者会冲突的主要原因是因为两者都有:javax.annotation.processing.Processor 于是在build.gradle中添加如下配置即可: // 注释冲突 packagingO ...

  3. 用JQuery编写textarea,input,checkbox,select

    今天学习怎样用JQuery编写一些小的代码,小小的试了一下编写一个textarea,代码如下: <!DOCTYPE HTML> <html lang="en"&g ...

  4. java集合_collection子接口 list的特有方法,ArrayList类体现

    /* Collection |--List:元素是有序的,元素可以重复.因为该集合体系有索引. |--ArrayList:底层的数据结构使用的是数组结构.特点:查询速度很快.但是增删稍慢.线程不同步. ...

  5. myeclipse-8.6.0下载

    myeclipse老版本不分32位和64位,欢迎大家下载使用! 链接:http://pan.baidu.com/s/1dEJCxcl 密码:z1ga

  6. 循环/loop 结构/structure

    1.Shell loop 2.C++/CPlusPlus ①.std::for_each ②.for loop ③.Iterator library 3.Python Loop ①.Python.or ...

  7. C++ 遇见的一些函数

    1.位与(&)操作,计算十进制数中的为"1"的位数 int cnt_one(int k) { ; //保存位为"1"的数量 while (k) { k ...

  8. Java初始化理解与总结 转载

    Java的初始化可以分为两个部分: (a)类的初始化 (b)对象的创建 一.类的初始化 1.1 概念介绍: 一个类(class)要被使用必须经过装载,连接,初始化这样的过程. 在装载阶段,类装载器会把 ...

  9. 安卓Fragment和Activity之间的数据通讯

    Fragment是Android3.0之后才推出来的.可以用来做底部菜单,现在很多APP都有用到这个底部菜单.当然TabHost也可以用来做底部菜单,但是Fragment来做,动画效果这些可以做得更炫 ...

  10. mysql show processlist 显示mysql查询进程

    1.进入mysql/bin目录下输入mysqladmin processlist; 2.启动mysql,输入show processlist; 如果有 SUPER 权限,则可以看到全部的线程,否则,只 ...