<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
    spring為ApplicationContext提供的3種實現分別為:ClassPathXmlApplicationContext, FileSystemXmlApplicationContext和XmlWebApplicationContext,其中 XmlWebApplicationContext是專為Web工程定制的。使用舉例如下:
       1. FileSystemXmlApplicationContext
         
    Java代碼 復制代碼
    1. eg1.   
    2. pplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml"); //加載單個配置文件  
     eg1.
    ApplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml"); //加載單個配置文件

         
    Java代碼 復制代碼
    1. eg2.   
    2. String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};   
    3. ApplicationContext ctx = new FileSystemXmlApplicationContext(locations ); //加載多個配置文件  
    eg2.
    String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};
    ApplicationContext ctx = new FileSystemXmlApplicationContext(locations ); //加載多個配置文件

          
    Java代碼 復制代碼
    1. eg3.       
    2. ApplicationContext ctx =new FileSystemXmlApplicationContext("D:roject/bean.xml");//根據具體路徑加載文件  
    eg3.
    ApplicationContext ctx =new FileSystemXmlApplicationContext("D:roject/bean.xml");//根據具體路徑加載文件

      2. ClassPathXmlApplicationContext
         
    Java代碼 復制代碼
    1. eg1.     
    2. pplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml");  
     eg1.
    ApplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml");

         
    Java代碼 復制代碼
    1.  eg2.   
    2. String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};   
    3. ApplicationContext ctx = new ClassPathXmlApplication(locations);   
    4. 注:其中FileSystemXmlApplicationContext和ClassPathXmlApplicationContext與BeanFactory的xml文件定位方式一樣是基于路徑的。  
     eg2.
    String[] locations = {"bean1.xml", "bean2.xml", "bean3.xml"};
    ApplicationContext ctx = new ClassPathXmlApplication(locations);
    注:其中FileSystemXmlApplicationContext和ClassPathXmlApplicationContext與BeanFactory的xml文件定位方式一樣是基于路徑的。

    3. XmlWebApplicationContext
    Java代碼 復制代碼
    1. eg1.   
    2. ServletContext servletContext = request.getSession().getServletContext();       
    3. ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext); 
    posted on 2010-02-02 14:28 seal 閱讀(264) 評論(0)  編輯  收藏 所屬分類: Spring
    主站蜘蛛池模板: 美女被羞羞网站免费下载| 亚洲国产夜色在线观看| 一区二区免费在线观看| 又爽又高潮的BB视频免费看| 日韩国产精品亚洲а∨天堂免| 成人无遮挡毛片免费看| 亚洲人成电影网站免费| 无码国模国产在线观看免费| 国产精品亚洲а∨无码播放不卡| 国产免费观看a大片的网站| 黄色免费在线网址| 最新精品亚洲成a人在线观看| 国产一级a毛一级a看免费视频| 亚洲国产精品无码av| **实干一级毛片aa免费| 亚洲三级视频在线| 国产成人青青热久免费精品| 成人特级毛片69免费观看| 亚洲精品国产美女久久久| 嘿嘿嘿视频免费网站在线观看 | 亚洲午夜久久久久久久久久| 你懂的网址免费国产| 亚洲黄色片免费看| 成人性生交大片免费看午夜a| 亚洲AV女人18毛片水真多| 亚洲日韩在线第一页| 日本免费一区二区三区| 亚洲黄页网在线观看| 亚洲?V无码成人精品区日韩| 免费av片在线观看网站| 亚洲人成网站看在线播放| 亚洲AV成人潮喷综合网| 99精品在线免费观看| 亚洲午夜无码毛片av久久京东热| 免费成人午夜视频| 69pao强力打造免费高清| 国产亚洲一卡2卡3卡4卡新区 | 免费无码又爽又刺激高潮视频| 亚洲久悠悠色悠在线播放| 亚洲无线一二三四区手机| 亚洲视频在线免费播放|