zoukankan      html  css  js  c++  java
  • 【Spring-AOP-1】AOP相关概念





    Advice

    (好多中文书籍翻译为:增强处理,比如前向增强、后向增强等)
    描述了Aspect类执行的具体动作。the job of an aspect.
    定义了如下两个方面:
    1. what:即Aspect类具体的功能;
    2. when:功能作用的时间点;
    在spring中,when包括5个:



    Join Points

    A join point is a point in the execution of the application where an aspect can be plugged in.
    This point could be a method being called, an exception being thrown, or even a field being modified.
    程序中可以有很多个join point,这些连接点可以是方法调用异常抛出、以及域修改等。这些都是在程序运行时的某个点。

    Pointcuts

    pointcut定义了advice需要在哪些join points进行织入。pointcuts define which join points get advised.
    可以简单理解为若干join point的集合,advice会在这些join points进行织入。
    If advice defines the what and when of aspects, then pointcuts define the where。
    pointcut definition matches one or more join points at which advice should be woven.

    Aspect

    An aspect is the merger of advice and pointcuts。
    Aspect是advice和pointcuts的组合。

    Introduction

    An introduction allows you to add new methods or attributes to existing classes。
    允许在已经存在的类中,添加新的方法和属性;

    WEAVING

    Weaving is the process of applying aspects to a target object to create a new proxied object。
    主要有3种织入方式:
    1. Compile time:AspectJ使用这种方式;
    2. Class load time:AspectJ使用这种方式;
    3. Runtime:Spring支持的方式;


    Spring对AOP的支持


    spring AOP基于动态的代理实现,局限于对方法的拦截

    • SPRING ADVICE IS WRITTEN IN JAVA :所有的advice都使用Java编写,pointcut可使用XML或annotation;
    • SPRING ADVISES OBJECTS AT RUNTIME:在运行时织入advice;
    • SPRING ONLY SUPPORTS METHOD JOIN POINTS:仅支持方法的join point;






  • 相关阅读:
    Logistic Regression
    Bootstrap研究2布局系统杂记
    《Programming in Scala》读书笔记(持续更新) passover的个人空间 DOIT博客 多易网
    《Scala, Erlang, F#作者讨论函数式语言》有感
    用python抓取oj题目(0)——重回战场 duoduo3_69 博客园
    Netty vs Apache MINA
    What is Akka?
    Fault Tolerance (Scala) — Akka Documentation
    execute phase · mrdon/mavencliplugin Wiki
    netty和mina的比较
  • 原文地址:https://www.cnblogs.com/ssslinppp/p/5580979.html
Copyright © 2011-2022 走看看