Last updated 5 years ago
Was this helpful?
()
Day 11-Spring Boot-如何載入靜態資源-使用thymeleaf模板引擎()
build.gradle 的 dependencies 中加入
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
並且在 resources 新增兩個資料夾 static, templates ((可以自行取名
之後在設定檔加上上述兩個資料夾的讀取位置
spring.thymeleaf.prefix=classpath:/templates //放模板 spring.thymeleaf.static-locations=classpath:/static//放靜態檔案