日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > javascript >内容正文

javascript

【Spring-AOP-1】AOP相关概念

發(fā)布時(shí)間:2024/1/17 javascript 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Spring-AOP-1】AOP相关概念 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.




Advice

(好多中文書(shū)籍翻譯為:增強(qiáng)處理,比如前向增強(qiáng)、后向增強(qiáng)等)描述了Aspect類執(zhí)行的具體動(dòng)作。the job of an aspect.定義了如下兩個(gè)方面:
  • what:即Aspect類具體的功能;
  • when:功能作用的時(shí)間點(diǎn);
  • 在spring中,when包括5個(gè):


    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.程序中可以有很多個(gè)join point,這些連接點(diǎn)可以是方法調(diào)用、異常拋出、以及域修改等。這些都是在程序運(yùn)行時(shí)的某個(gè)點(diǎn)。

    Pointcuts

    pointcut定義了advice需要在哪些join points進(jìn)行織入。pointcuts define which join points get advised.
    可以簡(jiǎn)單理解為若干join point的集合,advice會(huì)在這些join points進(jìn)行織入。If advice defines the what and when of aspects, then pointcuts define the where。
    A?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。
    允許在已經(jīng)存在的類中,添加新的方法和屬性;

    WEAVING

    Weaving is the process of applying aspects to a target object to create a new proxied?object。主要有3種織入方式:
  • Compile time:AspectJ使用這種方式;
  • Class load time:AspectJ使用這種方式;
  • Runtime:Spring支持的方式;


  • Spring對(duì)AOP的支持


    spring AOP基于動(dòng)態(tài)的代理實(shí)現(xiàn),局限于對(duì)方法的攔截。
    • SPRING ADVICE IS WRITTEN IN JAVA :所有的advice都使用Java編寫(xiě),pointcut可使用XML或annotation;
    • SPRING ADVISES OBJECTS AT RUNTIME:在運(yùn)行時(shí)織入advice;
    • SPRING ONLY SUPPORTS METHOD JOIN POINTS:僅支持方法的join point;




    來(lái)自為知筆記(Wiz)

    轉(zhuǎn)載于:https://www.cnblogs.com/ssslinppp/p/5580979.html

    總結(jié)

    以上是生活随笔為你收集整理的【Spring-AOP-1】AOP相关概念的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。