JAVA牛棚

          我們愛JAVA

          常用鏈接

          統計

          群友的BLOG

          最新評論

          Spring自動加載配置文件的用法原創

          作者:++

          ContextLoder  加載WEB.XML里的contextConfigLocation字段
          如下:
          <web-app>
            <display-name>bbscs6</display-name>
            <context-param>
              <param-name>contextConfigLocation</param-name>
              <param-value>/WEB-INF/applicationContext.xml</param-value>
            </context-param>
           </web-app>
           
           把/WEB-INF/applicationContext.xml加載入ApplicationContext
           并用servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ApplicationContext);加載到容器
          用 ApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext);來取出ApplicationContext
           ApplicationContext通過getBean("xxxx")來取到相應的bean

          posted on 2005-11-07 14:56 JAVA牛棚 閱讀(1934) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 龙里县| 滦平县| 白山市| 闽清县| 大厂| 石门县| 忻州市| 郑州市| 宝兴县| 阿拉尔市| 桦甸市| 双柏县| 昭觉县| 同德县| 朝阳县| 陵川县| 九龙城区| 渑池县| 阿拉善左旗| 固镇县| 大丰市| 湘西| 山阳县| 剑阁县| 无棣县| 伊金霍洛旗| 绍兴市| 承德县| 益阳市| 玛沁县| 姜堰市| 荔浦县| 南开区| 永泰县| 新安县| 东源县| 石门县| 桑日县| 嘉黎县| 南投县| 海兴县|