大大毛
的筆記
  DDM's Note
哪怕沒有辦法一定有說法,
就算沒有鴿子一定有烏鴉,
固執無罪 夢想有價,
讓他們驚訝.
posts - 14, comments - 23, trackbacks - 0, articles - 58
::
首頁
:: ::
聯系
:: ::
管理
夏昕spring學習筆記--02
Posted on 2006-03-15 17:55
大大毛
閱讀(458)
評論(0)
編輯
收藏
所屬分類:
Spring
備查:放上書上所寫的Bean配置及調用方式:
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
>
里面需要留意的就是空值及引用的寫法,測試中好象不加入那條DTD的定義,總報不合法的XML定義錯誤。
--使用:
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
"
);
再有里面提到有“熱布署”的名詞,應該就等同于:
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();
}
.;
}
}
事件傳播機制:
基于觀察者模式的實現。
由ApplicationContext負責通知全部實現了ApplicationListener接口的Bean,應該是不能實現分類通知的。
在例子中使用了instanceof這類的類型判斷,將Listener與Event牢牢掛住了,感覺不是很爽。
我的想法是:只在ApplictionContext中定義一個ApplictionListener,讓它充當分發器和缺省Event處理器的角色;在ActionEvent之上再封一個接口ActionEventEx,擴展一個接口getEvnetType,讓全部的ActionEvent實例都實現自ActionEventEx接口。并在ApplictionListener中實現一個BeanFactory,根據ActionEvent的實例,強轉至ActionEventEx,取得eventType,再從ApplictionContext中取得對應的Bean來處理事件。
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
夏昕spring學習筆記--02
夏昕spring學習筆記--01
手工添加MyEclipse的XML文件模板
Powered by:
BlogJava
Copyright © 大大毛
日歷
<
2025年5月
>
日
一
二
三
四
五
六
27
28
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
公告
果然是不能想得太好。
隨筆分類
(4)
VB培訓(4)
文章分類
(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)
積分與排名
積分 - 60269
排名 - 871
最新評論
1.?re: 手工添加MyEclipse的XML文件模板[未登錄]
請問,eclipse下面有沒有呢?現在想要實現eclipse的xml的模板進行配置修改,簡單說,就是把新建時候的名字作為其中的一個tag;找了很久沒有找到方法
--allen
2.?re: 第二章 Visual Basic 基礎語法
受益匪淺,多謝!
--yuleself
3.?re: 數字填空
評論內容較長,點擊標題查看
--去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去
4.?re: Checkbox聯動演示
dcdc
--dcd
5.?re: 利用TN5250NF下載檔案的自動化處理
請教若密碼要動態生成,是否有辦法呢?
謝謝
--江佳桂
i am ddm
主站蜘蛛池模板:
在线观看免费播放av片
|
国产成人免费高清激情明星
|
中文字幕亚洲一区二区三区
|
久久久免费精品re6
|
亚洲成年网站在线观看
|
亚洲国产专区一区
|
三年片在线观看免费大全电影
|
亚洲人成影院在线高清
|
亚洲狠狠爱综合影院婷婷
|
99视频精品全部免费观看
|
羞羞漫画在线成人漫画阅读免费
|
亚洲一区二区三区免费视频
|
久久亚洲精品无码av
|
亚洲av无码一区二区乱子伦as
|
青青草国产免费久久久91
|
午夜成人免费视频
|
91视频免费观看
|
亚洲欧美乱色情图片
|
亚洲国产精品SSS在线观看AV
|
日韩精品视频免费在线观看
|
毛片免费在线观看
|
国产亚洲精品美女久久久久
|
91嫩草私人成人亚洲影院
|
亚洲国产婷婷香蕉久久久久久
|
91香蕉视频免费
|
久久国产乱子免费精品
|
日本一区二区在线免费观看
|
色吊丝永久在线观看最新免费
|
花蝴蝶免费视频在线观看高清版
|
亚洲AV综合永久无码精品天堂
|
久久精品亚洲视频
|
亚洲欧洲精品成人久久曰影片
|
97视频热人人精品免费
|
亚洲一区免费观看
|
一级女性全黄生活片免费看
|
亚洲AV永久无码精品网站在线观看
|
午夜免费国产体验区免费的
|
麻豆狠色伊人亚洲综合网站
|
亚洲AV成人无码久久精品老人
|
亚洲七七久久精品中文国产
|
国产青草视频免费观看97
|