一、

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. sql查询某段时间内的数据

    查询半小时内数据的方法 1.select * from 表名 where datediff(minute,createtime,getdate())<30 2.select * from 表名 ...

  2. HTTP 错误 500.21 - Internal Server Error的解决方案

    开始菜单>所有程序>附件>命令提示符(以管理员的身份运行) 然后运行下面的命令注册: 32位机器: C:\Windows\Microsoft.NET\Framework\v4.0.3 ...

  3. sql server中分布式查询随笔

    由于业务逻辑的多样性 经常得在sql server中查询不同数据库中数据 这就产生了分布式查询的需求 现我将开发中遇到的几种查询总结如下: 1.access版本 --建立连接服务器 exec sp_a ...

  4. spring mvc 多视图配置

    <!-- jsp视图解析器--> <bean id="viewResolver" class="org.springframework.web.serv ...

  5. C++ 泛型编程/模板 泛函编程/Lambda/λ演算

    1.泛型编程(C++模板) 其中,Ada, Delpha, Java, C#, Swift 称之为 泛型/generics; ML, Scala和 Haskell 称之为 参数多态/parametri ...

  6. (poj)3020 Antenna Placement 匹配

    题目链接 : http://poj.org/problem?id=3020 Description The Global Aerial Research Centre has been allotte ...

  7. Poj/OpenJudge 1094 Sorting It All Out

    1.链接地址: http://poj.org/problem?id=1094 http://bailian.openjudge.cn/practice/1094 2.题目: Sorting It Al ...

  8. 【HeadFirst设计模式】10.状态模式

    定义: 允许对象在内部状态改变时改变它 行为,对象看起来好像修改了它的类. OO原则: 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松耦合设计而努力 类应该对扩展开放, ...

  9. php 中 isset()函数 和 empty()函数的区别

    首先这两个函数都是用来测试变量的状态: isset()函数判断一个变量是否在 如果存在返回true  否则返回false empty()函数判断一个变量是否为空,如果为空返回true 否则返回fals ...

  10. 算法之插入排序(inertionSort)

    插入排序的基本操作就是将一个数据插入到已经排好序的有序数据中,从而得到一个新的.个数加一的有序数据,适用于少量数据的排序,时间复杂度为O(n^2). 插入排序属于稳定排序. 插入排序不需要构造新的数据 ...