在春季启动<= 2.4.3时,下面的代码片段运行良好。
<div class="link-red ddmenu" th:with="urls=${new String[]{'/'}}"
th:classappend="${#arrays.contains(urls, #httpServletRequest.getRequestURI()) ? 'selected' : ''}">
<a href="/" th:href="@{/}"> <i class="fa fas fa-home"></i>Home
</a>
</div>
但是在升级到2.7.0之后,我得到了这个解析异常。我该怎么做才能修好它?
Exception evaluating SpringEL expression: "new String[]{'/'}"
或任何Thymeleaf官方网站上提供的任何相关信息?
发布于 2022-05-27 04:45:04
有趣的是,如果您一直向下查看堆栈跟踪,则会在底部发现此错误:
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1005E: Type cannot be found 'String'
如果我将表达式更改为:
th:with="urls=${new java.lang.String[]{'/'}}"
一切都为我工作(用Spring 2.6.7测试)。
https://stackoverflow.com/questions/72393962
复制相似问题