1、配置pom.xml
<thymeleaf.version>3.0.6.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2、在src/main/resources/templates/下建立*.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" /></meta>
<title>Insert title here</title>
</head>
<body>
<h1>
Hello,
</h1>
</body>
</html>
3、编辑Controller文件
/**
* @auth yeputi1015 QQ953916078 枣庄智行公交
*/
@Controller
@RequestMapping("/templates")
public class TemplateController {
/**
* 返回html模板.
*/
@GetMapping("/helloHtml")
public String helloHtml(){
return "helloHtml";
}
}