<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                **1.MyAdvice2 ** ~~~ public class MyAdvice2 { //處理連接點 public Object around(ProceedingJoinPoint pjp){ Object o = null; try{ System.out.println("環繞通知-前置"); o = pjp.proceed();//執行被代理對象方法 System.out.println("環繞通知-后置"); }catch(Throwable throwable){ throwable.printStackTrace(); System.out.println("異常通知"); }finally { System.out.println("環繞通知-最終"); } return o; } } ~~~ **2.配置信息** ~~~ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd"> <!--注冊目標對象--> <bean name="userService" class="com.nobb.service.UserServiceImpl"></bean> <!--注冊通知對象--> <bean name="myAdvice" class="com.nobb.advice.MyAdvice2"></bean> <aop:config> <!--定義切點--> <!--任意返回值 com.nobb.service 包下的任意 ServiceImpl結尾的 任意方法 任意參數--> <aop:pointcut id="myPC" expression="execution(* com.nobb.service.*ServiceImpl.*(..))"/> <aop:aspect ref="myAdvice"> <!--環繞切面:切點+環繞通知--> <aop:around method="around" pointcut-ref="myPC"/> </aop:aspect> </aop:config> </beans> ~~~ **3.測試代碼** ~~~ package com.test; import com.nobb.service.UserService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:applicationContext2.xml") public class AopDemo { //byName @Resource(name="userService") private UserService userService; @Test public void fun1(){ userService.save(); } } ~~~ **4.測試結果** 環繞通知-前置 save() 環繞通知-后置 環繞通知-最終
                  <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>

                              哎呀哎呀视频在线观看