Java蜘蛛人 歡迎大家
歡迎大家 來到我的blog , 如果我身邊的朋友 有什么不懂可以直接來問我 我會細心的幫助你的. 如果網(wǎng)絡上的朋友有什么不懂的 可以加我Java蜘蛛人 QQ48187537
posts - 54, comments - 192, trackbacks - 0, articles - 1
導航
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
<
2009年2月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
1
2
3
4
5
6
7
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(14)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2009年10月 (1)
2009年7月 (2)
2009年6月 (1)
2009年5月 (3)
2009年4月 (2)
2009年3月 (2)
2009年2月 (6)
2008年10月 (1)
2008年8月 (1)
2008年7月 (1)
2008年3月 (2)
2008年2月 (4)
2008年1月 (4)
2007年12月 (1)
2007年11月 (3)
2007年10月 (2)
2007年9月 (4)
2007年8月 (14)
文章檔案
2007年8月 (1)
搜索
最新評論
1.?re: JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋
siqishangshu@foxmail.com
求一份呀,謝謝了
--siqishangshu
2.?re: Spring 中的國際化
評論內容較長,點擊標題查看
--最代碼
3.?re: JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋
樓主 能發(fā)一份給我嗎?謝謝 1124376059@qq.com
--小里
4.?re: javaScript 實現(xiàn)樹型
評論內容較長,點擊標題查看
--lizhi
5.?re: Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋
怎么地址錯誤 ,,,求大神發(fā)這相視頻給我,,QQ:461782455
--想要這個視頻
閱讀排行榜
1.?Spring 配置log4j(21009)
2.?webservice 視頻教程 Spring+xfire 整合 java蜘蛛人- 鄭成橋 (6880)
3.?Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋 (5670)
4.?Eclipse開發(fā)JQuery環(huán)境設置(Spket)(5333)
5.?spring junit 測試 java蜘蛛人- 鄭成橋 (4485)
評論排行榜
1.?JSP 整合 discuz 論壇 java蜘蛛人 -- 鄭成橋(40)
2.?webservice 視頻教程 Spring+xfire 整合 java蜘蛛人- 鄭成橋 (23)
3.?Acegi視頻教程 (做權限管理的) 主講人: 鄭成橋 (14)
4.?Ext js 視頻 我今天下午講的(14)
5.?Spring 整合javamail 用 gmail 發(fā)送郵件(8)
Spring AOP advice
Posted on 2009-02-13 12:25
Java蜘蛛人 --鄭成橋
閱讀(1128)
評論(0)
編輯
收藏
很很常用的before ,After ........等等
返回參數(shù)的通知全套代碼:
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
"
);
}
}
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © Java蜘蛛人 --鄭成橋
主站蜘蛛池模板:
白山市
|
班玛县
|
运城市
|
株洲县
|
慈溪市
|
澄江县
|
逊克县
|
自贡市
|
铁力市
|
电白县
|
开平市
|
吴旗县
|
安康市
|
罗江县
|
泾阳县
|
南部县
|
和田市
|
塔城市
|
定结县
|
紫云
|
克拉玛依市
|
武夷山市
|
枞阳县
|
长泰县
|
新泰市
|
元江
|
祁东县
|
南汇区
|
和静县
|
惠东县
|
赤峰市
|
云安县
|
阿拉善右旗
|
庆阳市
|
玉环县
|
宝兴县
|
白朗县
|
吉木乃县
|
阳曲县
|
凤台县
|
韶关市
|