关于初次使用Thymeleaf遇到的问题 2020-08-11

关于初次使用Thymeleaf遇到的问题

环境:

IDEA :2020.1

Maven:3.5.6

SpringBoot: 2.3.2

原做法:

按照视频教程,导入依赖,并修改报的版本为3.0.9,适配包的布局功能修改为2.2.2

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
切换thymeleaf版本
<properties>
		<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
		<!-- 布局功能的支持程序  thymeleaf3主程序  layout2以上版本 -->
		<!-- thymeleaf2   layout1-->
		<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
  </properties>

报错:

org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration.templateEngine(ThymeleafAutoConfiguration.java:142)  The following method did not exist:

修正方法:

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

直接引入依赖,不需要修改,让SpringBoot 帮助我们自动适配版本号即可。


还有一个未知问题,在视频教程笔记(.pdf)复制下来的文本导入依赖时无法识别文本中的 ‘ - ’ 。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring‐boot‐starter‐thymeleaf</artifactId>
2.1.6
</dependency>

重新输入 ‘ - ’ 即可导入依赖。

初步怀疑是编码问题

2020-08-11

原文地址:https://www.cnblogs.com/l1ng14/p/13477062.html