问题:启动项目报错Error resolving template [index], template might not exist
解决办法:
1、先检查项目结构,先静态资源文件的位置是否放错了
2、查看pom.xml中thymeleaf依赖是否导入正确
一开始我只导入了下面的依赖,但是报错
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
3、改为下面的,重新下载就好使了
<!-- thymeleaf 依赖-->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring5</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>