有可能是thymeleaf依賴導入異常,或者沒導入thymeleaf依賴
可以嘗試到pom.xml中導入thymeleaf依賴
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
如果改完發現還是報500錯誤,可以去application.properties文件中將thymeleaf的緩存關閉
spring.thymeleaf.cache=false