要使用
#temporals对象,您需要
thymeleaf-extras-java8time在项目中包含模块。这是Extras模块的GitHub页面。
该模块增加了一个
#temporals类似物体#dates或#calendars在标准方言的,允许从Thymeleaf模板的格式和时间对象的创建。
在Spring Boot的1.4.1版本中,仅需要包括extras模块,并且自动配置将为您设置它。确保您提供的版本正确,取决于您的Thymeleaf版本:
- 版本3.0.0.RELEASE-适用于Thymeleaf 3.0(需要Thymeleaf 3.0.0+)
- 版本2.1.0.RELEASE-适用于Thymeleaf 2.1(需要Thymeleaf 2.1.3+)
我的弹簧靴和百里香叶版本与您相同,并且由于我提供了不合适的Extras版本(3.0.0)而收到了相同的错误。将其切换到较低版本可解决此问题(在我的情况下为maven
pom文件):
<dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-java8time</artifactId> <version>2.1.0.RELEASE</version></dependency>



