<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    閑人野居
    好好學習,天天向上
    posts - 57,  comments - 137,  trackbacks - 0
    在spring2.0中,aop發生了很大的變化:
    主要分為兩大方面
    1.支持簡單的aop xml配置
    2.支持@AspectJ的注釋

    先來看一看第一種情況:
    申明一個aspect,在xml中的申明如下:

    <aop:config>

    ? <aop:aspect id="myAspect" ref="aBean">

    ??? ...

    ? </aop:aspect>

    </aop:config>

    <bean id="aBean" class="...">

    ? ...

    </bean>


    申明pointcut

    <aop:config>

    ? <aop:pointcut id="businessService"

    ??????? expression="execution(* com.xyz.myapp.service.*.*(..))"/>

    </aop:config>


    申明advice

    Before advice

    <aop:aspect id="beforeExample" ref="aBean">

    ??? <aop:before

    ????? pointcut-ref="dataAccessOperation"

    ????? method="doAccessCheck"/>

    </aop:aspect>

    After returning advice:

    <aop:aspect id="afterReturningExample" ref="aBean">

    ?

    ??? <aop:after-returning

    ????? pointcut-ref="dataAccessOperation"

    ????? method="doAccessCheck"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    或者帶有返回參數

    <aop:aspect id="afterReturningExample" ref="aBean">

    ?

    ??? <aop:after-returning

    ????? pointcut-ref="dataAccessOperation"

    ???? ?returning="retVal"

    ????? method="doAccessCheck"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    ?

    After throwing advice

    <aop:aspect id="afterThrowingExample" ref="aBean">

    ?

    ??? <aop:after-throwing

    ????? pointcut-ref="dataAccessOperation"

    ????? method="doRecoveryActions"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    或者帶有throwing

    <aop:aspect id="afterThrowingExample" ref="aBean">

    ?

    ??? <aop:after-throwing

    ????? pointcut-ref="dataAccessOperation"

    ????? throwing="dataAccessEx"

    ????? method="doRecoveryActions"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    After (finally) advice

    <aop:aspect id="afterFinallyExample" ref="aBean">

    ?

    ??? <aop:after

    ????? pointcut-ref="dataAccessOperation"

    ????? method="doReleaseLock"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    Around advice

    <aop:aspect id="aroundExample" ref="aBean">

    ?

    ??? <aop:around

    ????? pointcut-ref="businessService"

    ????? method="doBasicProfiling"/>

    ?????????

    ??? ...

    ???

    </aop:aspect>

    Advice parameters

    <aop:before

    ? pointcut="Pointcuts.anyPublicMethod() and @annotation(auditable)"

    ? method="audit"

    ??arg-names="auditable"/>


    對于引入接口(Introductions):

    <aop:aspect id="usageTrackerAspect" ref="usageTracking">

    ? <aop:declare-parents

    ????? types-matching="com.xzy.myapp.service.*+",

    ????? implement-interface="UsageTracked"
    ????? default-impl=" service.tracking.DefaultUsageTracked"/>

    ? <aop:before

    ??? pointcut="com.xyz.myapp.SystemArchitecture.businessService()

    ????????????? and this(usageTracked)"

    ??? method="recordUsage"/>

    </aop:aspect>

    ?
    posted on 2006-09-15 09:41 布衣郎 閱讀(1995) 評論(0)  編輯  收藏 所屬分類: aopspring

    <2006年9月>
    272829303112
    3456789
    10111213141516
    17181920212223
    24252627282930
    1234567

    常用鏈接

    留言簿(12)

    隨筆分類(59)

    隨筆檔案(57)

    blog

    java

    uml

    搜索

    •  

    積分與排名

    • 積分 - 358030
    • 排名 - 156

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲一级片在线观看| 亚洲色欲久久久久综合网| 亚洲精品自产拍在线观看| 久久精品国产亚洲网站| 亚洲午夜久久久久久噜噜噜| 在线观看亚洲免费视频| 热久久精品免费视频| 在线观看日本亚洲一区| 一区二区三区免费在线观看| 18禁超污无遮挡无码免费网站 | tom影院亚洲国产一区二区| 亚洲精品国产免费| 永久免费毛片手机版在线看| 亚洲精品无码专区| 最好免费观看高清在线| 亚洲av无码专区在线播放| 久操免费在线观看| 亚洲AV综合色区无码二区偷拍| 国产免费AV片在线播放唯爱网| 亚洲综合欧美色五月俺也去| 国产性生交xxxxx免费| 色爽黄1000部免费软件下载| 国产亚洲视频在线播放| 小说区亚洲自拍另类| 无码不卡亚洲成?人片| 亚洲免费在线视频观看| 怡红院免费的全部视频| 国产嫩草影院精品免费网址| 永久免费观看黄网站| 亚洲AV人无码激艳猛片| 中文字幕不卡免费视频| 国产一级淫片视频免费看| 亚洲2022国产成人精品无码区 | 国国内清清草原免费视频99| 亚洲aⅴ天堂av天堂无码麻豆| av大片在线无码免费| 亚洲精品私拍国产福利在线| 成年轻人网站色免费看| 一个人免费观看视频在线中文| 亚洲色图视频在线观看| jizzjizz亚洲|