當我再次回到w3嘗試理解其中所講的aop的時候,發現兩者的不同:
w3:
<?xml version="1.0" encoding="utf-8"?>
xmlns
=""xmlns:xsi
=""xmlns:aop
=""xsi:schemalocation
="/spring-beans-3.0.xsd
/spring-aop-3.0.xsd "
>
<
aop:config
>
<
aop:aspectid=
"log"
ref="logging"
>
<
aop:pointcutid=
"selectall"
expression
="execution(* com.tutorialspoint.*.*(..))"
/>
<
aop:before
pointcut-ref
="selectall"
method
="beforeadvice"
/>
<
aop:after
pointcut-ref
="selectall"
method
="afteradvice"
/>
<
aop:after-returning
pointcut-ref
="selectall"
returning
="retval"
method
="afterreturningadvice"
/>
<
aop:after-throwing
pointcut-ref
="selectall"
throwing
="ex"
method
="afterthrowingadvice"
/>
aop:aspect
>
aop:config
>
"student"
class
="com.tutorialspoint.student"
>
name
="name"
value
="zara"
/>
name
="age"
value
="11"
/>
bean
>
"logging"
class
="com.tutorialspoint.logging"
/>
beans
>
hsp:
<?xml version="1.0" encoding="utf-8"?>
xmlns
=""xmlns:xsi
=""xmlns:aop
=""xsi:schemalocation
="/spring-beans-3.0.xsd
/spring-aop-3.0.xsd "
>
name
="testservice"
class
="com.tutorialspoint.testservice"
>
name
="name"
value
="hongchang"
>
property
>
bean
>
name
="testservice2"
class
="com.tutorialspoint.testservice"
>
name
="name"
value
="dydy"
>
property
>
bean
>
name
="mymethodbeforeadvice"
class
="com.tutorialspoint.mymethodbeforeadvice"
>
bean
>
name
="mymethodafteradvice"
class
="com.tutorialspoint.mymethodafteradvice"
>
bean
>
name
="proxyfactorybean1"
class
="org.springframework.aop.framework.proxyfactorybean"
>
name
="proxyinte***ces"
>
>
>
com.tutorialspoint.testserviceintervalue
>
list
>
property
>
name
="interceptornames"
>
>
>
mymethodbeforeadvicevalue
>
>
mymethodafteradvicevalue
>
list
>
property
>
name
="target"
ref="testservice"
>
property
>
bean
>
beans
>
更加簡潔,而且在呼叫的層面來看,現在的方式也更加合理:
w3:
public
class
}
像完全沒有配置aop一樣進行正常的beans的獲取和使用
hsp:
public
class
}
而以前,我們發現我們需要通過獲取**物件並轉成相應介面來呼叫相應方法,從某種程度來看,這是一種耦合的表現。 學習心得 python學習心得
自從來了深圳工作以後,尤其是屢屢面試碰壁以後。發現其實自己的知識面很窄,做筆試題的時候絞盡腦汁還是漏洞百出,並不是不會做,而是出現一大堆不該有的失誤。每次被問道,對資料庫了解嗎?說一大堆看起來很高階的東西 好啊,那我們寫幾個sql語句吧。馬上完蛋了,沒了手冊關鍵字都記不起。了解哪幾種指令碼語言,sh...
學習心得 我的學習心得
我是乙個已經步入中年的70後,離開校園已經20年了,因為當年的政策因素而未能圓我的大學夢,在20年的工作過程中總是因為缺少一張大學文憑而失去了很多機會,曾經也考慮過自考,但是乙個人去面對的時候總感覺心有餘而力不足。2018年3月份偶然讓我認識了尚德,原來自考還可以這樣學習。一直懷疑自己年紀大了記憶力...
Spring學習心得
不看不知道,一看便學到,會不會與您產生共鳴呢?喜歡再捧場拍磚 spring使用從一年前開始,邊學習邊開發。這裡講講我的學習心得。第一條 記住ioc就是spring的一切。而掌握ioc的唯一方法就是使用和思考。spring是ioc為核心的,所以第一步就是要深刻理解ioc,最好是能盡快把ioc作為教條式...