<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

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲精品视频在线| 亚洲av永久无码精品表情包| 又粗又硬又黄又爽的免费视频| 亚洲最大视频网站| 日本一区二区三区免费高清在线| 日韩欧毛片免费视频| 亚洲mv国产精品mv日本mv| 18勿入网站免费永久| 免费国产成人午夜私人影视 | 亚洲AV第一页国产精品| av永久免费网站在线观看| 美女视频黄免费亚洲| 亚洲午夜久久久精品电影院| 中文字幕影片免费在线观看| 亚洲日韩中文在线精品第一| 一级特黄录像免费播放中文版| 国产亚洲精品激情都市| 亚洲色大成网站www| vvvv99日韩精品亚洲| 久久国产精品免费一区| 亚洲午夜免费视频| 成年在线网站免费观看无广告| 亚洲aⅴ无码专区在线观看| 亚洲综合精品网站| 最近中文字幕电影大全免费版| 亚洲人成77777在线播放网站不卡 亚洲人成77777在线观看网 | 久久久久亚洲AV成人无码网站 | 国产精品公开免费视频| 亚洲伊人久久大香线蕉结合| 日本v片免费一区二区三区| 亚洲一级片在线观看| 免费人成视网站在线观看不卡| 日韩精品无码免费专区网站 | 亚洲精品国产高清不卡在线| 亚洲色偷偷综合亚洲av78 | 亚洲熟妇无码一区二区三区| 亚洲伦乱亚洲h视频| 亚洲一级免费毛片| 日韩久久无码免费毛片软件 | 国产精品亚洲а∨天堂2021| 亚洲av福利无码无一区二区|