• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會(huì)很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::

            ClassLoader可以用來方便的加載資源文件. 但如果資源文件在jar包里,不可使用Thread.currentThread().getContextClassLoader()來加載.

            方法: Thread.currentThread().getContextClassLoader();

            Returns the context ClassLoader for this Thread. The context ClassLoader is provided by the creator of the thread for use by code running in this thread when loading classes and resources. If not set, the default is the ClassLoader context of the parent Thread. The context ClassLoader of the primordial thread is typically set to the class loader used to load the application.

            例如在Tomcat自己寫的Servlet中,返回的ClassLoader如下,對(duì)應(yīng)的目錄是/WEB-INF/classes/:

            WebappClassLoader
              delegate: false
              repositories:
                /WEB-INF/classes/
            ----------> Parent Classloader:
            org.apache.catalina.loader.StandardClassLoader@5c74c3aa
            所以如Hibernate, log4j, struts等把配置文件按規(guī)則取名,直接放在/WEB-INF/classes/目錄里,會(huì)被自動(dòng)的找到,而不需要做其他的配置。

            而在普通的運(yùn)用程序中,即自己寫的類的ClassLoader: Test.class.getClassLoader().




            posted on 2010-10-25 04:25 逛奔的蝸牛 閱讀(761) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Java
            久久人人爽人人爽人人片AV麻烦 | 国产亚洲精午夜久久久久久| 久久国产亚洲精品麻豆| 97超级碰碰碰碰久久久久| 污污内射久久一区二区欧美日韩| 久久天天躁狠狠躁夜夜躁2014| 亚洲AV日韩AV永久无码久久| 亚洲午夜久久久精品影院| 国产精品乱码久久久久久软件| 婷婷综合久久中文字幕蜜桃三电影| 久久久久久久尹人综合网亚洲 | 久久精品国产亚洲av麻豆图片 | 中文字幕久久久久人妻| 伊人久久综合热线大杳蕉下载| 少妇久久久久久被弄到高潮| 久久精品国产亚洲AV麻豆网站| 国内精品久久久久久久影视麻豆| 亚洲国产精品无码成人片久久 | 亚洲精品无码久久久久sm| 久久亚洲国产精品一区二区| 狠狠色婷婷久久综合频道日韩| 99久久精品免费国产大片| 国产产无码乱码精品久久鸭 | 国产99精品久久| 99精品国产综合久久久久五月天| 91久久精品无码一区二区毛片| 久久国产免费观看精品3| 要久久爱在线免费观看| 理论片午午伦夜理片久久 | 亚洲国产精品无码久久久不卡 | 久久精品中文字幕久久| 久久久一本精品99久久精品66| 伊人久久大香线蕉综合网站| 精品国产热久久久福利| 久久这里只有精品首页| 国产精品99久久精品| 国产精品一区二区久久不卡| 国产精品9999久久久久| 久久久精品午夜免费不卡| 中文字幕成人精品久久不卡| 久久九九有精品国产23百花影院|