• <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>

            逛奔的蝸牛

            我不聰明,但我會很努力

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

            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如下,對應的目錄是/WEB-INF/classes/:

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

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




            posted on 2010-10-25 04:25 逛奔的蝸牛 閱讀(761) 評論(0)  編輯 收藏 引用 所屬分類: Java
            国产精品gz久久久| 怡红院日本一道日本久久| 国产精品青草久久久久福利99| 久久99精品国产一区二区三区| AA级片免费看视频久久| 一本一道久久a久久精品综合| 久久综合综合久久综合| 国产成人精品综合久久久| 欧美激情精品久久久久久久| 久久无码专区国产精品发布| 国产成人精品久久二区二区| 亚洲国产成人精品女人久久久| 久久亚洲春色中文字幕久久久| 99久久婷婷国产一区二区| 久久精品国产日本波多野结衣| 免费国产99久久久香蕉| 伊人久久大香线蕉成人| 岛国搬运www久久| 777米奇久久最新地址| 亚洲综合久久夜AV | 91精品国产91久久久久久| 久久亚洲国产成人精品性色| 国产精品久久久久免费a∨| 国产99久久久国产精品~~牛| 日韩人妻无码精品久久久不卡| 久久99亚洲综合精品首页| AV无码久久久久不卡网站下载| 中文字幕人妻色偷偷久久 | 久久精品中文字幕久久| 亚洲国产综合久久天堂 | 日产精品久久久久久久性色| 午夜精品久久久内射近拍高清 | 久久综合一区二区无码| 国产亚洲精午夜久久久久久| 国产综合久久久久| 精品久久久无码人妻中文字幕豆芽| 久久经典免费视频| 中文字幕久久久久人妻| 亚洲av伊人久久综合密臀性色| 久久综合亚洲鲁鲁五月天| 欧美黑人激情性久久|