解決:springboot訪問static 404

springboot 遇到不能訪問靜態資源的情況

首先springboot 是默認訪問static的 引用JS CSS 路徑不需要帶上static
如果8080直接訪問靜態資源 404

This application has no explicit mapping for /error, so you are seeing this as a fallback.
出現這種錯誤 訪問controller一般是沒問題的 是靜態資源沒有加載到tomcat中

看了其他帖子有說在properties中配置路徑的 其實現在springboot不需要特地配置 默認映射到static了

把Build project automatically這個勾上

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章