• <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 逛奔的蝸牛 閱讀(768) 評論(0)  編輯 收藏 引用 所屬分類: Java
            精品国产综合区久久久久久| 精品国产VA久久久久久久冰| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 狠狠色婷婷久久一区二区三区| 久久国产乱子精品免费女| 欧美激情精品久久久久久久九九九| 伊人久久大香线蕉AV色婷婷色| 一本久久久久久久| 久久久婷婷五月亚洲97号色| 久久se这里只有精品| 激情伊人五月天久久综合| 欧美日韩精品久久久免费观看| 国产人久久人人人人爽| 亚洲欧美日韩久久精品| 97久久综合精品久久久综合| 久久99热这里只频精品6| 日本精品久久久久中文字幕| 久久婷婷激情综合色综合俺也去| 国产精品99久久久精品无码| 久久av高潮av无码av喷吹| 97久久精品无码一区二区| 亚洲精品乱码久久久久久按摩| 思思久久99热免费精品6| 93精91精品国产综合久久香蕉| 2021久久精品国产99国产精品| 亚洲午夜久久久久久噜噜噜| 国产欧美久久久精品影院| 欧美久久天天综合香蕉伊| 一本伊大人香蕉久久网手机| 久久中文娱乐网| 一本大道加勒比久久综合| 久久99国产亚洲高清观看首页 | 久久精品国产亚洲一区二区三区| 国产精品久久久久久久久免费| 精品国产一区二区三区久久久狼| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 91久久成人免费| 激情五月综合综合久久69| 一本大道久久a久久精品综合| 久久99精品免费一区二区| 久久www免费人成精品香蕉|