<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發(fā)生了很大的變化:
    主要分為兩大方面
    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>

    或者帶有返回參數(shù)

    <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

    搜索

    •  

    積分與排名

    • 積分 - 358017
    • 排名 - 156

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: a级亚洲片精品久久久久久久| 亚洲经典在线中文字幕| 无码av免费网站| 亚洲国产精品专区| 国产一级淫片a免费播放口之| 岛国精品一区免费视频在线观看 | 国产精品99精品久久免费| 亚洲欧洲高清有无| 成人亚洲综合天堂| 精品无码人妻一区二区免费蜜桃| 亚洲av午夜电影在线观看| 亚洲Aⅴ无码专区在线观看q| 成人片黄网站色大片免费| 东北美女野外bbwbbw免费| 亚洲狠狠色丁香婷婷综合| 亚洲成av人片天堂网| 国产成人啪精品视频免费网| 四虎影视成人永久免费观看视频 | 亚洲午夜精品久久久久久app| 国产AV无码专区亚洲AWWW| 毛片免费在线视频| 永久免费av无码网站yy| 在线亚洲精品视频| 亚洲天堂一区在线| 精品国产综合成人亚洲区 | 无码乱人伦一区二区亚洲| 国产乱子伦精品免费女| 亚洲成人免费网址| 中文字幕成人免费高清在线视频| 亚洲日韩AV无码一区二区三区人| 亚洲AV日韩AV天堂一区二区三区| 免费人成网站在线高清| 毛片网站免费在线观看| 特级无码毛片免费视频尤物| jizz免费一区二区三区| 亚洲av无码一区二区三区人妖 | 亚洲av成人一区二区三区在线观看 | 久久亚洲熟女cc98cm| 久久精品国产亚洲5555| 日本高清免费不卡视频| 青青青免费国产在线视频小草|