- pom.xml 中加入
org.springframework.boot
spring-boot-starter-thymeleaf
- application.properites中加入
#定位模板的目录
spring.mvc.view.prefix=classpath:/templates/
#给返回的页面添加后缀名
spring.mvc.view.suffix=.html
3.controler层:
@RequestMapping("/index")
public String index(){
return “index”;
}
springboot + thymeleaf 访问首页
最新推荐文章于 2022-12-09 09:16:01 发布