spring-boot 加載本地靜態資源文件路徑配置


1.spring boot默認加載文件的路徑是 
/META-INF/resources/ 
/resources/ 
/static/ 
/public/ 
這些目錄下面, 當然我們也可以從spring boot源碼也可以看到 

private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {  
        "classpath:/META-INF/resources/", "classpath:/resources/",  
        "classpath:/static/", "classpath:/public/" }; 

所有本地的靜態資源都配置在了classpath下面了, 而非在webapp下了 

2.目錄結構詳見附件 

項目地址https://github.com/leelance/spring-boot-all


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM