<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### aspect的定義 1. 定義一個切面: \[關鍵字aspect\] 這定義Java類的語法類似;例:public aspect HelloAspect 2. 定義pointcut:  [修飾符\(public,protected.....\)] pointcut poincutName\(\) : 表達式; 3. 定義advice:   通知類型\(\) : pointcut名字\(\){ 處理邏輯} 示例: ``` package com.aspectj.demo.aspect; public aspect HelloAspect { pointcut HelloWorldPointCut() : execution(* main(..)); before() : HelloWorldPointCut(){ System.out.println("all cut====>"); } } ``` ### aspect通知類型 * before 目標方法執行前執行,前置通知 * after 目標方法執行后執行,后置通知 * after returning 目標方法返回時執行 ,后置返回通知 * after throwing 目標方法拋出異常時執行 異常通知 * around 在目標函數執行中執行,可控制目標函數是否執行,環繞通知 示例: ``` /** * 定義前置通知 * * before(參數):連接點函數{ * 函數體 * } */ before():authCheck(){ System.out.println("sayHello方法執行前驗證權限"); } /** * 定義后置通知 * after(參數):連接點函數{ * 函數體 * } */ after():recordLog(){ System.out.println("sayHello方法執行后記錄日志"); } /** * 定義后置通知帶返回值 * after(參數)returning(返回值類型):連接點函數{ * 函數體 * } */ after()returning(int x): get(){ System.out.println("返回值為:"+x); } /** * 異常通知 * after(參數) throwing(返回值類型):連接點函數{ * 函數體 * } */ after() throwing(Exception e):sayHello2(){ System.out.println("拋出異常:"+e.toString()); } /** * 環繞通知 可通過proceed()控制目標函數是否執行 * Object around(參數):連接點函數{ * 函數體 * Object result=proceed();//執行目標函數 * return result; * } */ Object around():aroundAdvice(){ System.out.println("sayAround 執行前執行"); Object result=proceed();//執行目標函數 System.out.println("sayAround 執行后執行"); return result; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看