Spring security 试图对空上下文对象调用方法表达式(java.lang.String)
我在我的spring应用程序中使用安全性Spring security 试图对空上下文对象调用方法表达式(java.lang.String),spring-security,thymeleaf,Spring Security,Thymeleaf,我在我的spring应用程序中使用安全性 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> 然后我制作了菜单,在那里我尝试制作注销按钮: <li th:if="${#authorization.expre
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
然后我制作了菜单,在那里我尝试制作注销按钮:
<li th:if="${#authorization.expression('isAuthenticated()')}">
<a href="/logout" th:href="@{/logout}">Logout</a>
</li>
如何修复它?尝试在授权对象的末尾添加一个问号,在使用它之前检查它是否为空
${#authorization?.expression('isAuthenticated()')}
您的依赖项列表中有用于Spring安全性的thymeleaf扩展吗?
org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 15): Method call: Attempted to call method expression(java.lang.String) on null context object
${#authorization?.expression('isAuthenticated()')}