为什么我在使用 Thymeleaf 的安全导航运算符时得到 "ExpressionSyntaxException: Malformed OGNL expression"?

Why am I getting an "ExpressionSyntaxException: Malformed OGNL expression" when using Thymeleaf's safe navigation operator?

出于某种原因,我在使用 Thymeleaf 的安全导航运算符 (${inter.someObj?.field}) 时收到 ExpressionSyntaxException: Malformed OGNL expression。如果我摆脱运营商,没有问题。 Spring-引导 2.6.2,百里香 3.0.14。项目是使用 Thymeleaf 的 OGNL 设置的,显然不是使用 SpEl 的 spring-boot-starter-thymeleaf。有人知道我为什么要得到这个吗?以及(希望)如何摆脱它?

根据 https://northcoder.com/post/thymeleaf-vs-spel-vs-ognl/ the safe navigation operator 仅在使用 Spring 表达式语言时可用:

SpEL offers several enhancements which are not available in OGNL - and therefore not available in the Thymeleaf standard dialect. For example, it has the safe navigation operator, which provides a convenient way to handle null values when evaluating expressions.