第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

為什么我的輸入結(jié)果和視頻里的不一樣?(Around advice)

我的輸出結(jié)果(代碼是一樣的):

MoocAspect before.

MoocAspect aroud 1.

AspectBiz biz.

MoocAspect afterReturning.

MoocAspect after.

MoocAspect aroud 2.

正在回答

5 回答

因?yàn)槭请S機(jī)的,你可以用order設(shè)置順序,詳見spring文檔。文檔中的finally僅僅表示一定會被執(zhí)行,并不代表最后被執(zhí)行

0 回復(fù) 有任何疑惑可以回復(fù)我~

public void before()

{

System.out.println("MoocAspect before.");

}

public void afterReturning()

{

System.out.println("MoocAspect afterReturning.");

}

public void afterThrowing()

{

System.out.println("MoocAspect afterThrowing.");

}

public void after()

{

System.out.println("MoocAspect after.");

}

public Object around(ProceedingJoinPoint pjp)

{

Object obj = null;

try

{

System.out.println("MoocAspect aroud 1.");

obj = pjp.proceed();

System.out.println("MoocAspect aroud 2.");

} catch (Throwable e)

{

e.printStackTrace();

}

return obj;

}

0 回復(fù) 有任何疑惑可以回復(fù)我~

你定義的順序和結(jié)果是一樣的么?你看一下你的定義順序,都是按定義的順序執(zhí)行的。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

砂鍋飯嘍 提問者

定義順序是指moocAspect這個類中的順序嗎?這個類中方法的順序和視頻中是一樣的
2015-03-04 回復(fù) 有任何疑惑可以回復(fù)我~
#2

Coda 回復(fù) 砂鍋飯嘍 提問者

是的,就是moocAspect
2015-03-04 回復(fù) 有任何疑惑可以回復(fù)我~
#3

砂鍋飯嘍 提問者 回復(fù) Coda

moocAspect中代碼已貼出,順序?yàn)閎efore,afterReturning,afterThrowing,after,around
2015-03-04 回復(fù) 有任何疑惑可以回復(fù)我~

配置文件如下:

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

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/aop

? ? http://www.springframework.org/schema/aop/spring-aop-3.1.xsd

">

<bean id="moocAspect" class="com.yxq.aop.MoocAspect"></bean>

<bean id="aspectBiz" class="com.yxq.aop.AspectBiz"></bean>

<aop:config>

? <aop:aspect id="moocAspectAOP" ref="moocAspect">

? ? ?<aop:pointcut expression="execution(* com.yxq.aop.*Biz.*(..))" id="moocPointcut"/>

? ? ?<aop:before method="before" pointcut-ref="moocPointcut"/>

? ? ?<aop:after-returning method="afterReturning" pointcut-ref="moocPointcut"/>

? ? ?<aop:after-throwing method="afterThrowing" pointcut-ref="moocPointcut"/>

? ? ?<aop:after method="after" pointcut-ref="moocPointcut"/>

? ? ?<aop:around method="around" pointcut-ref="moocPointcut"/>

? </aop:aspect>

</aop:config>

</beans>

0 回復(fù) 有任何疑惑可以回復(fù)我~

你的配置文件也要和視頻的一樣

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

砂鍋飯嘍 提問者

我覺得我的配置文件和視頻上的應(yīng)該是一樣的,除了Spring版本不一致,配置文件已貼出
2015-03-04 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為什么我的輸入結(jié)果和視頻里的不一樣?(Around advice)

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號