1
私は春のアプリケーションでセキュリティを使用しています。nullコンテキストオブジェクトのメソッド式(java.lang.String)を呼び出そうとしました
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
、ここでのログインのための私のコントローラである:
@Configuration
static class ClientWebConfig extends WebMvcConfigurerAdapter {
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("fragments/login");
}
}
それから私は、menueをしたし、そこに私は、ログアウトボタンを作ってみました:
<li th:if="${#authorization.expression('isAuthenticated()')}">
<a href="/logout" th:href="@{/logout}">Logout</a>
</li>
私はlogin correctly
ことができますが、ときに文句を言うメニューを読み込みます。
org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 15): Method call: Attempted to call method expression(java.lang.String) on null context object
どうすれば修正できますか?
あなたの依存関係リストで春のセキュリティのためのthymeleaf拡張を持っていますか? –