<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 布衣郎 閱讀(1985) 評論(0)  編輯  收藏 所屬分類: aopspring

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

    常用鏈接

    留言簿(12)

    隨筆分類(59)

    隨筆檔案(57)

    blog

    java

    uml

    搜索

    •  

    積分與排名

    • 積分 - 357241
    • 排名 - 155

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 色偷偷女男人的天堂亚洲网| 亚洲综合日韩久久成人AV| 亚洲国产精品综合久久久| 国产一区二区免费视频| 国产亚洲3p无码一区二区| eeuss免费影院| 亚洲精品无码久久久影院相关影片 | 免费播放特黄特色毛片| 特级一级毛片免费看| 亚洲А∨精品天堂在线| 老妇激情毛片免费| AV在线亚洲男人的天堂| 中文在线观看免费网站| 亚洲一区中文字幕久久| 永久免费毛片在线播放| 亚洲av无码专区在线电影| 亚洲成年人啊啊aa在线观看| 一级毛片免费观看不收费| 国产亚洲成AV人片在线观黄桃| 一级毛片全部免费播放| 亚洲一区二区三区四区视频 | 亚洲熟妇无码久久精品| 无遮免费网站在线入口| 亚洲AV女人18毛片水真多| ZZIJZZIJ亚洲日本少妇JIZJIZ| 日本免费在线中文字幕| 亚洲国产成a人v在线| 国产在线观看免费不卡| 9i9精品国产免费久久| 亚洲精品视频观看| 四虎国产精品免费久久影院| 巨胸喷奶水视频www免费视频| 亚洲色图在线观看| 免费视频淫片aa毛片| h视频在线观看免费| 亚洲毛片在线免费观看| avtt亚洲天堂| 国产91免费在线观看| 黄色毛片视频免费| 亚洲国产品综合人成综合网站| 免费人妻无码不卡中文字幕18禁 |