一、添加依赖
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-devtools
true
二、application.yml 配置文件
spring:
#模版配置
thymeleaf:
#避免修改模版后还要重启
cache: false
#模版路径,默认为templates(可忽略)
prefix: classpath:/templates/
#检查模版位置(可忽略)
check-template-location: true
#模版后缀,默认html(可忽略)
suffix: .html
encoding: UTF-8
servlet:
content-type: text/html
#模版模式
mode: HTML
三、新建controller
@GetMapping(value = "/login")
public String login() {
return "login";
}
四、在templates中建login.html
Titlehello world
五、File->settings->Build,Execution,Deployment->Complier:勾选Build project automatically -> apply ->ok
六、shift + alt + ctrl + /
至此当你修改HTML时已经不需要重启项目了,解决了调试页面布局以及小的改动就要充气项目的烦恼!