参考多篇文章:引入thymeleaf
时没有报错,但就是无法运行SpringBoot
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<properties>
<java.version>1.8</java.version>
<!-- thymeleaf 版本 -->
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<!-- 布局功能的支持程序 thymeleaf3主程序 layout2以上版本 -->
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
</properties>
大致问题可以归结于版本的问题<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
需要改为:<thymeleaf.version>3.1.1.RELEASE</thymeleaf.version>
然后重新刷新一下:
等待最下方进度条走完,在重新启动SpringBoot,即可正常运行。
2021-11-12 10:23:37.215 INFO 10952 --- [ main] com.atguigu.springboot.Application : No active profile set, falling back to default profiles: default
2021-11-12 10:23:38.113 INFO 10952 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-11-12 10:23:38.123 INFO 10952 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-12 10:23:38.123 INFO 10952 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.54]
2021-11-12 10:23:38.224 INFO 10952 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-12 10:23:38.224 INFO 10952 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 964 ms
2021-11-12 10:23:38.490 INFO 10952 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [public/index.html]
2021-11-12 10:23:38.595 INFO 10952 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-11-12 10:23:38.603 INFO 10952 --- [ main] com.atguigu.springboot.Application : Started Application in 1.809 seconds (JVM running for 2.891)