• <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等把配置文件按規(guī)則取名,直接放在/WEB-INF/classes/目錄里,會被自動的找到,而不需要做其他的配置。

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




            posted on 2010-10-25 04:25 逛奔的蝸牛 閱讀(760) 評論(0)  編輯 收藏 引用 所屬分類: Java
            久久成人永久免费播放| 久久天天躁狠狠躁夜夜躁2014| 91久久精品91久久性色| AA级片免费看视频久久| 怡红院日本一道日本久久 | 99久久精品免费| 亚洲午夜福利精品久久| 成人资源影音先锋久久资源网| 久久精品18| 久久国产精品无码HDAV| 久久亚洲高清综合| 国产精品禁18久久久夂久| 色老头网站久久网| 久久国产精品免费| 99久久综合狠狠综合久久止| 99久久免费国产精品特黄| 久久精品国产WWW456C0M| 久久无码人妻一区二区三区午夜| 久久久久国产精品麻豆AR影院| 久久婷婷五月综合国产尤物app| 欧洲性大片xxxxx久久久| 99久久免费国产精品| 久久精品aⅴ无码中文字字幕重口| 久久伊人中文无码| 精品一久久香蕉国产线看播放| 久久ww精品w免费人成| 亚洲精品无码久久久久久| 亚洲精品国产自在久久| 久久久久亚洲爆乳少妇无| 91麻精品国产91久久久久| 久久精品9988| 久久精品国产精品亚洲精品| 国内精品久久久久久久97牛牛| 精品久久久久久无码不卡| 午夜精品久久影院蜜桃| 无码国内精品久久人妻麻豆按摩| 99久久免费只有精品国产| 国产高清国内精品福利99久久| 色综合久久精品中文字幕首页 | 97精品国产97久久久久久免费 | 一本色道久久综合狠狠躁篇 |