一、

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. php的标记形式

    共三种: 推荐第一种,第三种需要在php.ini中配置 效果: 第三种配置 将short_open_tag=Off改为On重启Apache就可以了

  2. DOS批处理命令-@命令

    @命令是一个禁止当前语句回显的简单命令. 语法: @[command].[command]是要屏蔽的批处理命令 例如执行包含以下内容的bat文件 echo on @echo ------- @echo ...

  3. apache http server 多线程模式

    一般apache采用prefork和worker机制,通过apachectl -l命令查看默认使用的prefork机制.需要修改prefork策略 那么需要做如下修改: 1,/usr/local/ap ...

  4. ios 单例模式(懒汉式)

    1. 单例模式的作用 可以保证在程序运行过程,一个类只有一个实例,而且该实例易于供外界访问 从而方便地控制了实例个数,并节约系统资源 2. 单例模式的使用场合 在整个应用程序中,共享一份资源(这份资源 ...

  5. 牵扯较多属性和方法的类题目,很简单的题目本来不想发的,如果有同学学到这个题目感觉太长不愿敲代码,copy走我的即可~不过还是建议自己打一打

    /* 3.设计一个"学生"类 1> 属性 * 姓名 * 生日 * 年龄 * 身高(单位是m) * 体重(单位是kg) * 性别 * C语言成绩 * OC成绩 * iOS成绩 ...

  6. unity发布ios游戏总结

    自己做了几个ios的小游戏,因此总结了一点经验 判断按钮要用unity里面的button不要用OnMouseDown()之类的函数,否则拒绝原因为缺少ios特征 排行榜之类的本地存储数据,不要用本地本 ...

  7. OpenJudge 2813 画家问题 / Poj 1681 Painter's Problem

    1.链接地址: http://bailian.openjudge.cn/practice/2813 http://poj.org/problem?id=1681 2.题目: 总时间限制: 1000ms ...

  8. java.util.Hashtable源码分析

    Hashtable实现一个键值映射的表.任何非null的object可以用作key和value. 为了能存取对象,放在表里的对象必须实现hashCode和equals方法. 一个Hashtable有两 ...

  9. Github上关于大数据的开源项目、论文等合集

    https://github.com/onurakpolat/awesome-bigdata

  10. socket通信_笔记

    (socket通信) 客户端与服务器端通信问题: 我们首先要了解一个概念性的词汇:Socket socket的英文原义是“孔”或“插座”.作为进程通信机制,取后一种意思.通常也称作“套接字”,用于描述 ...