<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html @Controller public class MyController { @RequestMapping("/myPage") public String myPage(Model model) { model.addAttribute("message", "Hello, Thymeleaf!"); return "myPage"; } } <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>My Page</title> </head> <body> <h1 th:text="${message}"></h1> </body> </html> 通过以上步骤,就可以实现Spring Boot整合Thymeleaf的功能。