隨筆 - 303  文章 - 883  trackbacks - 0
          <2007年9月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          歡迎光臨! 
          閑聊 QQ:1074961813

          隨筆分類(357)

          我管理的群

          公共blog

          • n維空間
          • Email : java3d@126.com 群 : 12999758

          參與管理的論壇

          好友的blog

          我的其他blog

          朋友的網站

          搜索

          •  

          最新評論

          隨手寫的,不知道發上來有沒有人看。平臺myEclipse6.0M1

          /src/applicationContext.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <beans
              
          xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation
          ="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
              
          <bean id="hello" class="com.lusm.spring.test.Hello" abstract="false"
                  lazy-init
          ="default" autowire="default" dependency-check="default">
                  
          <property name="str">
                      
          <value>你好?。。?!</value>
                  
          </property>
              
          </bean>
          </beans>

          /src/com/lusm/spring/test/HelloTest.java

          package com.lusm.spring.test;

          import org.springframework.context.ApplicationContext;
          import org.springframework.context.support.FileSystemXmlApplicationContext;

          public class HelloTest {

              
          public static void main(String[] args) {
                  ApplicationContext ac 
          = new FileSystemXmlApplicationContext(
                          
          "/src/applicationContext.xml");
                  Hello h 
          = (Hello) ac.getBean("hello");
                  h.sayHello();
              }


          }

          /src/com/lusm/spring/test/Hello.java

          package com.lusm.spring.test;

          public class Hello {
              
          private String str;

              
          public String getStr() {
                  
          return str;
              }


              
          public void setStr(String str) {
                  
          this.str = str;
              }


              
          public void sayHello() {
                  System.out.println(str);
              }


          }


          運行結果

          log4j:WARN No appenders could be found for logger (org.springframework.context.support.FileSystemXmlApplicationContext).
          log4j:WARN Please initialize the log4j system properly.

          你好?。。。?br />

          一個簡單的spring就這么?。?br />


          地震讓大伙知道:居安思危,才是生存之道。
          posted on 2007-09-12 21:17 小尋 閱讀(950) 評論(5)  編輯  收藏 所屬分類: j2se/j2ee/j2me

          FeedBack:
          # re: 小小的spring2.0例子 2007-09-13 10:48 仙人指路
          不錯不錯,雖然我看不懂,老弟繼續努力  回復  更多評論
            
          # re: 小小的spring2.0例子 2007-09-13 10:49 仙人指路
          轉載的很多,自己寫的比較少,以后多寫點  回復  更多評論
            
          # re: 小小的spring2.0例子 2007-09-13 23:02 幻想~@@~
          呵呵 謝謝 會的  回復  更多評論
            
          # re: 小小的spring2.0例子[未登錄] 2008-05-21 11:29 JACK
          不錯 可以跑了。謝謝  回復  更多評論
            
          # re: 小小的spring2.0例子 2008-06-04 10:01 zouahaijun
          寫得確實太簡單了,沒有發揮出spring2.0的優勢所在,好好加油啊  回復  更多評論
            
          主站蜘蛛池模板: 三台县| 仲巴县| 礼泉县| 会昌县| 胶州市| 深圳市| 永清县| 勃利县| 伊春市| 漯河市| 临高县| 嘉义市| 哈尔滨市| 峨山| 丰城市| 邵阳县| 安化县| 龙山县| 于都县| 东丰县| 合肥市| 奉化市| 吐鲁番市| 西盟| 新营市| 聂荣县| 宾阳县| 会昌县| 安化县| 台北县| 合阳县| 克山县| 桦南县| 莒南县| 白山市| 灵川县| 通道| 诏安县| 桑日县| 金塔县| 乌拉特中旗|