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

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

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

    神魂顛倒

    Memo

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      0 隨筆 :: 3 文章 :: 3 評論 :: 0 Trackbacks

    When working with enterprise applications, you often want to refer to modules of the application and particular sets of operations from within several aspects. We recommend defining a "SystemArchitecture" aspect that captures common pointcut expressions for this purpose. A typical such aspect would look as follows:

     

    package com.xyz.someapp;

    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Pointcut;

    @Aspect
    public class SystemArchitecture {

      
    /**
       * A join point is in the web layer if the method is defined
       * in a type in the com.xyz.someapp.web package or any sub-package
       * under that.
       
    */

      @Pointcut(
    "within(com.xyz.someapp.web..*)")
      
    public void inWebLayer() {}

      
    /**
       * A join point is in the service layer if the method is defined
       * in a type in the com.xyz.someapp.service package or any sub-package
       * under that.
       
    */

      @Pointcut(
    "within(com.xyz.someapp.service..*)")
      
    public void inServiceLayer() {}

      
    /**
       * A join point is in the data access layer if the method is defined
       * in a type in the com.xyz.someapp.dao package or any sub-package
       * under that.
       
    */

      @Pointcut(
    "within(com.xyz.someapp.dao..*)")
      
    public void inDataAccessLayer() {}

      
    /**
       * A business service is the execution of any method defined on a service
       * interface. This definition assumes that interfaces are placed in the
       * "service" package, and that implementation types are in sub-packages.
       * 
       * If you group service interfaces by functional area (for example, 
       * in packages com.xyz.someapp.abc.service and com.xyz.def.service) then
       * the pointcut expression "execution(* com.xyz.someapp..service.*.*(..))"
       * could be used instead.
       *
       * Alternatively, you can write the expression using the 'bean'
       * PCD, like so "bean(*Service)". (This assumes that you have
       * named your Spring service beans in a consistent fashion.)
       
    */

      @Pointcut(
    "execution(* com.xyz.someapp.service.*.*(..))")
      
    public void businessService() {}
      
      
    /**
       * A data access operation is the execution of any method defined on a 
       * dao interface. This definition assumes that interfaces are placed in the
       * "dao" package, and that implementation types are in sub-packages.
       
    */

      @Pointcut(
    "execution(* com.xyz.someapp.dao.*.*(..))")
      
    public void dataAccessOperation() {}

    }

    The pointcuts defined in such an aspect can be referred to anywhere that you need a pointcut expression. For example, to make the service layer transactional, you could write:

     

    <aop:config>
      
    <aop:advisor 
          
    pointcut="com.xyz.someapp.SystemArchitecture.businessService()"
          advice-ref
    ="tx-advice"/>
    </aop:config>

    <tx:advice id="tx-advice">
      
    <tx:attributes>
        
    <tx:method name="*" propagation="REQUIRED"/>
      
    </tx:attributes>
    </tx:advice>

    The <aop:config> and <aop:advisor> elements are discussed in Section 6.3, “Schema-based AOP support”. The transaction elements are discussed in Chapter 9, Transaction management.

    posted on 2008-07-25 22:53 star 閱讀(129) 評論(0)  編輯  收藏 所屬分類: Spring

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 羞羞漫画小舞被黄漫免费| 国产成人亚洲综合一区| 成年网站免费入口在线观看| 成人免费午间影院在线观看| 亚洲一级片在线观看| 亚州免费一级毛片| 亚洲第一网站免费视频| 5555在线播放免费播放| 亚洲成a人片在线网站| 在线视频精品免费| 亚洲av无码一区二区三区观看| 在线观看免费视频资源| 亚洲成a人片7777| 成年男女男精品免费视频网站 | 成人免费福利视频| 亚洲国产成人精品久久| 最近最新的免费中文字幕| 亚洲日韩精品国产一区二区三区| 成人免费视频小说| 爱情岛论坛免费视频| 亚洲一区无码中文字幕| 久久久久久影院久久久久免费精品国产小说 | 无码国产精品一区二区免费虚拟VR| 亚洲一区二区三区久久久久| 在线免费观看毛片网站| 日本高清免费中文在线看| 亚洲va中文字幕无码久久不卡 | 亚洲色成人WWW永久在线观看| 国产青草视频在线观看免费影院| 日本在线观看免费高清| 日韩亚洲人成在线综合日本| 99久久国产热无码精品免费| 无码亚洲成a人在线观看| 国产成人亚洲精品狼色在线| 国产成人免费午夜在线观看 | 国产一级黄片儿免费看| 亚洲宅男天堂a在线| 一本色道久久88亚洲综合| 性无码免费一区二区三区在线| 亚洲无人区码一二三码区别图片| 亚洲精品无码av天堂|