Springboot開發常見問題總結

本文會持續不定時更新

1.配置靜態資源路徑

spring.resources.static-locations=classpath:/templates/,classpath:/static/

2.返回的視圖名不能與訪問路徑相同

@RequestMapping("index")
public String hello(){
    return "/index.html";
}

注:當訪問 http://ip:port/index 時,將會產生異常,不能正常訪問到index.html頁面

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