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

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

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

    Java蜘蛛人 歡迎大家

    歡迎大家 來到我的blog , 如果我身邊的朋友 有什么不懂可以直接來問我 我會細心的幫助你的. 如果網絡上的朋友有什么不懂的 可以加我Java蜘蛛人 QQ48187537
    posts - 54, comments - 192, trackbacks - 0, articles - 1

    Spring AOP advice

    Posted on 2009-02-13 12:25 Java蜘蛛人 --鄭成橋 閱讀(1123) 評論(0)  編輯  收藏

    很很常用的before ,After ........等等


    返回參數的通知全套代碼:
    package com.zcq.dao;

    public interface Person {
        
        
    public String getName(String name,String pass);

    }



    package com.zcq.dao;

    public class PersonImp implements Person {

        
    public String getName(String name, String pass) {
            System.out.println(
    "hehe");
            String bb 
    ="aa";
            
            
    return bb;
        }


    }



    package com.zcq.dao;

    import org.aspectj.lang.JoinPoint;

    public class AspectClass {
        
        
        
    public String getName(JoinPoint joinPoint,String bb)
        
    {
             
            System.out.println(bb);
            
    return  null;
        }


    }



    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
            xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:aop
    ="http://www.springframework.org/schema/aop"
            xmlns:tx
    ="http://www.springframework.org/schema/tx"
            xsi:schemaLocation
    ="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
                
                
                
    <bean id="aspectClass" class="com.zcq.dao.AspectClass"></bean>
                
    <bean  id="personimp" class="com.zcq.dao.PersonImp"></bean>
                
                
    <aop:config>
                  
    <aop:aspect id="addAllMethod" ref="aspectClass">
                    
    <aop:pointcut id="addpointcut" expression="execution(public * get*(..))" />
                  
    <aop:after-returning  pointcut-ref="addpointcut" method="getName"  returning="bb" />
                   
    <!--    <aop:after-throwing pointcut-ref="addpointcut" method="getName" throwing="tx"  />  --> 
                  
    </aop:aspect>            
                
    </aop:config>
    </beans>


    package com.zcq.dao;

    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;

    public class Test {

        
    /**
         * 
    @param args
         
    */

        
    public static void main(String[] args) {
            
            
            ApplicationContext ctx
    = null;
            
            ctx
    = new ClassPathXmlApplicationContext("applicationContext.xml");
            
            Person p  
    = (Person)ctx.getBean("personimp");
            
            p.getName(
    "name""pass");

             
        }


    }


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


    網站導航:
     
    主站蜘蛛池模板: 亚洲无码一区二区三区 | 成人AV免费网址在线观看| 亚洲成Av人片乱码色午夜| 中文字幕在线免费视频| 亚洲精品无码成人AAA片| 一区二区三区免费看| 中文字幕第13亚洲另类| 中文字幕永久免费| 亚洲AV无码一区二区三区系列| 精品在线免费观看| 亚洲视频在线观看不卡| 久久久高清免费视频| 亚洲AV无码国产剧情| 亚洲精品A在线观看| 国产免费无码一区二区| 久久精品国产亚洲av麻豆小说| 67pao强力打造国产免费| 亚洲精品人成网在线播放影院| 精品剧情v国产在免费线观看 | 国产激情久久久久影院老熟女免费| 激情综合色五月丁香六月亚洲| 免费在线看黄的网站| 亚洲av无码国产综合专区| 国产精品免费看久久久久| 国产精品免费久久久久电影网| 亚洲av色影在线| 欧洲黑大粗无码免费| 人成免费在线视频| 麻豆亚洲AV永久无码精品久久 | 亚洲熟妇少妇任你躁在线观看| 免费在线观看理论片| 国产午夜不卡AV免费| 亚洲youjizz| 久久久久国产亚洲AV麻豆| 日本最新免费网站| 一级女性全黄生活片免费看| 亚洲色图.com| 亚洲 综合 国产 欧洲 丝袜 | 青娱乐在线视频免费观看| 午夜亚洲www湿好大| 日韩电影免费在线|