- 在pom.xml中增加thymeleaf依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
- 如果你的視圖不是放在/templates/下面柬泽,需要在springboot文件中更改view的視圖路徑
spring:
thymeleaf:
prefix: classpath:/templates
suffix: .html