springboot:映射静态资源路径
生活随笔
收集整理的這篇文章主要介紹了
springboot:映射静态资源路径
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
#映射靜態資源路徑 spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:F:/myCode/springBootCode/IdeaProjects/architect/#顯示mybatis的sql logging.level.com.atchina.springbootmvcproject.mapper = debug?
在application.properties文件中,使用 spring.resources.static-locations 映射靜態資源路徑
suolong.jpg是在本地磁盤上存儲的,沒有再項目中存儲,映射了靜態資源路徑后,我們就可以通過url訪問該資源。
?
?
?
而lufei.jpg是在項目中存儲的,同樣的spring.resources.static-locations中也映射了classpath:/static/,所以我們也可以通過url訪問該資源。
?
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的springboot:映射静态资源路径的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: springboot: ajax异步提交
- 下一篇: nginx-http服务器