1、添加依赖
org.springframework.boot
spring-boot-starter-thymeleaf
2、写Controller
@Controller
public class IndexController {
@RequestMapping(value = "/index")
public String index(Model model){
model.addAttribute("data","Springboot 框架集成 Thymeleaf");
return"index";
}
}
3、写html文件
在html中添加
Title
xxx
4、写主配置文件
关闭缓存
#设置thymeleaf模板引擎的缓存 spring.thymeleaf.cache=false #设置thymeleaf模板引擎的前后缀 spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html
5、更改工件配置文件
修改为
Update resources
Update resources
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)