Spring配置中的"classpath:"與"classpath*:"的區別

來源:互聯網
上載者:User

標籤:使用   ring   classpath   資源檔   一個   載入   規劃   包括   因此   

classpath:

  • 只會到你的class路徑中尋找找檔案;
  • 有多個classpath路徑,並同時載入多個classpath路徑的情況下,只會從第一個classpath中載入。

classpath*:

  • 不僅包含class路徑,還包括jar檔案中(class路徑)進行尋找;
  • 有多個classpath路徑,並同時載入多個classpath路徑的情況下,會從所有的classpath中載入;
  • 用classpath*:需要遍曆所有的classpath,所以載入速度是很慢的;因此,在規劃的時候,應該儘可能規劃好資源檔所在的路徑,盡量避免使用classpath*。

Spring配置中的"classpath:"與"classpath*:"的區別

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.