大大毛
的筆記
DDM's Note
哪怕沒(méi)有辦法一定有說(shuō)法,
就算沒(méi)有鴿子一定有烏鴉,
固執(zhí)無(wú)罪 夢(mèng)想有價(jià),
讓他們驚訝.
posts - 14, comments - 23, trackbacks - 0, articles - 58
::
首頁(yè)
:: ::
聯(lián)系
:: ::
管理
日歷
<
2025年7月
>
日
一
二
三
四
五
六
29
30
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
29
30
31
1
2
3
4
5
6
7
8
9
公告
果然是不能想得太好。
隨筆分類(lèi)
(4)
VB培訓(xùn)(4)
文章分類(lèi)
(59)
JAVA
(6)
Spring
(3)
Hibernate
Struts
(12)
NET
VB
(2)
ASP
(1)
ASP.NET
(6)
HTML
(3)
400
(2)
I4.0
Nifi
(5)
Angular
(1)
SQL
(15)
常用算法
(1)
其它
(2)
積分與排名
積分 - 60804
排名 - 867
最新評(píng)論
1.?re: 手工添加MyEclipse的XML文件模板[未登錄](méi)
請(qǐng)問(wèn),eclipse下面有沒(méi)有呢?現(xiàn)在想要實(shí)現(xiàn)eclipse的xml的模板進(jìn)行配置修改,簡(jiǎn)單說(shuō),就是把新建時(shí)候的名字作為其中的一個(gè)tag;找了很久沒(méi)有找到方法
--allen
2.?re: 第二章 Visual Basic 基礎(chǔ)語(yǔ)法
受益匪淺,多謝!
--yuleself
3.?re: 數(shù)字填空
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去
4.?re: Checkbox聯(lián)動(dòng)演示
dcdc
--dcd
5.?re: 利用TN5250NF下載檔案的自動(dòng)化處理
請(qǐng)教若密碼要?jiǎng)討B(tài)生成,是否有辦法呢?
謝謝
--江佳桂
夏昕spring學(xué)習(xí)筆記--02
Posted on 2006-03-15 17:55
大大毛
閱讀(465)
評(píng)論(0)
編輯
收藏
所屬分類(lèi):
Spring
備查:放上書(shū)上所寫(xiě)的Bean配置及調(diào)用方式:
xml version="1.0" encoding="UTF-8"?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"
>
<
beans
>
<
description
>
Spring Bean Configuration Sample
</
description
>
<
bean
id
="TheAction"
⑴
class
="net.xiaxin.spring.qs.UpperAction"
⑵
singleton
="true"
⑶
init-method
="init"
⑷
destroy-method
="cleanup"
⑸
depends-on
="ActionManager"
⑹
>
<
property
name
="message"
>
<
value
>
HeLLo
</
value
>
⑺
</
property
>
<
property
name
="desc"
>
<
null
/>
</
property
>
<
property
name
="dataSource"
>
<
ref
local
="dataSource"
/>
⑻
</
property
>
</
bean
>
<
bean
id
="dataSource"
class
="org.springframework.jndi.JndiObjectFactoryBean"
>
<
property
name
="jndiName"
>
<
value
>
java:comp/env/jdbc/sample
</
value
>
</
property
>
</
bean
>
</
beans
>
里面需要留意的就是空值及引用的寫(xiě)法,測(cè)試中好象不加入那條DTD的定義,總報(bào)不合法的XML定義錯(cuò)誤。
--使用:
InputStream is
=
new
FileInputStream(
"
beans.xml
"
);
XmlBeanFactory factory
=
new
XmlBeanFactory(is);
Action action
=
(Action) factory.getBean(
"
TheAction
"
);
或
ApplicationContext ac
=
new
FileSystemXmlApplicationContext(
"
beans.xml
"
);
Action action
=
(Action)ac.getBean(
"
TheAction
"
);
再有里面提到有“熱布署”的名詞,應(yīng)該就等同于:
public
class
MyProperties
{
private
String fileName
=
null
;
private
File propFile
=
null
;
private
long
lastModified ;
public
MyProperties(String fileName)
{
this
.fileName
=
fileName;
}
private
void
loadPropFile()
{
this
.propFile
=
new
File(
this
.fileName);
}
private
boolean
isChanged()
{
boolean
changed
=
false
;
if
(
this
.propFile.lastModified()
!=
this
.lastModified)
{
changed
=
true
;
}
return
changed;
}
public
Object getProp(String propName)
{
if
(isChanged())
{
this
.loadPropFile();
}
.;
}
}
事件傳播機(jī)制:
基于觀(guān)察者模式的實(shí)現(xiàn)。
由ApplicationContext負(fù)責(zé)通知全部實(shí)現(xiàn)了ApplicationListener接口的Bean,應(yīng)該是不能實(shí)現(xiàn)分類(lèi)通知的。
在例子中使用了instanceof這類(lèi)的類(lèi)型判斷,將Listener與Event牢牢掛住了,感覺(jué)不是很爽。
我的想法是:只在ApplictionContext中定義一個(gè)ApplictionListener,讓它充當(dāng)分發(fā)器和缺省Event處理器的角色;在ActionEvent之上再封一個(gè)接口ActionEventEx,擴(kuò)展一個(gè)接口getEvnetType,讓全部的ActionEvent實(shí)例都實(shí)現(xiàn)自ActionEventEx接口。并在ApplictionListener中實(shí)現(xiàn)一個(gè)BeanFactory,根據(jù)ActionEvent的實(shí)例,強(qiáng)轉(zhuǎn)至ActionEventEx,取得eventType,再?gòu)腁pplictionContext中取得對(duì)應(yīng)的Bean來(lái)處理事件。
新用戶(hù)注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶(hù)
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
管理
相關(guān)文章:
夏昕spring學(xué)習(xí)筆記--02
夏昕spring學(xué)習(xí)筆記--01
手工添加MyEclipse的XML文件模板
Powered by:
BlogJava
Copyright © 大大毛
i am ddm
主站蜘蛛池模板:
彝良县
|
思茅市
|
呈贡县
|
永寿县
|
奉贤区
|
台湾省
|
陇西县
|
巴彦淖尔市
|
星子县
|
雅安市
|
开江县
|
陵水
|
丰镇市
|
会同县
|
丽江市
|
清丰县
|
济南市
|
牙克石市
|
连云港市
|
玉山县
|
乌海市
|
吉木萨尔县
|
张家界市
|
涡阳县
|
永年县
|
泸州市
|
盱眙县
|
尼玛县
|
仁化县
|
图们市
|
和静县
|
江阴市
|
长武县
|
石景山区
|
安阳县
|
富源县
|
库尔勒市
|
兰考县
|
远安县
|
益阳市
|
鄂州市
|