spring學(xué)習(xí)(二)
今天繼續(xù)學(xué)習(xí)spring,按照《Spring 開發(fā)指南》go on,結(jié)果到22頁的時(shí)候發(fā)現(xiàn)有如下代碼
InputStream is = new FileInputStream("bean.xml");
XmlBeanFactory factory = new XmlBeanFactory(is);
Action action = (Action) factory.getBean("TheAction");
使用junit4測試發(fā)送,發(fā)現(xiàn)有錯(cuò)誤,但是依舊可以運(yùn)行得到預(yù)期的結(jié)果。
查看API以及去網(wǎng)上baidu了一圈,發(fā)現(xiàn)底層的確沒有xmlbeanfactory(inputstream )的方法,但是不知道為什么夏老師依舊這樣寫?
我根據(jù)API中方法,這樣實(shí)現(xiàn)
Resource in = new FileSystemResource("bean1.xml");
XmlBeanFactory factory = new XmlBeanFactory((Resource) in);
Action action = (Action) factory.getBean("TheAction");
System.out.println(action.execte("xixi hha "));
不知道,這個(gè)算不算是《Spring 開發(fā)指南》中的又一BUG
等那天有時(shí)間 在單位找找牛人問問。
不知道你發(fā)現(xiàn)這個(gè)問題么?說說你是怎么理解的,大家一起交流一下么?



查看API以及去網(wǎng)上baidu了一圈,發(fā)現(xiàn)底層的確沒有xmlbeanfactory(inputstream )的方法,但是不知道為什么夏老師依舊這樣寫?
我根據(jù)API中方法,這樣實(shí)現(xiàn)




不知道,這個(gè)算不算是《Spring 開發(fā)指南》中的又一BUG
等那天有時(shí)間 在單位找找牛人問問。
不知道你發(fā)現(xiàn)這個(gè)問題么?說說你是怎么理解的,大家一起交流一下么?
posted on 2008-09-26 22:41 冷面閻羅 閱讀(492) 評(píng)論(0) 編輯 收藏 所屬分類: java