# 在application.properties中配置
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.mode=HTML5
在Pom.xml添加依赖
<!-- 静态页面跳转-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
不能用@RestController
@Controller
public class TestController {
@RequestMapping("login")
public String hello(){
return "login";
}
}
@RequestMapping("hh")
public String hh(){
return "hah/hee";
}