Spring Security - No visible WebSecurityExpressionHandler instance could be found in the application context

前端 未结 1 1249
情歌与酒
情歌与酒 2020-12-17 09:36

I am having trouble displaying a logout link in a JSP page only if the user is authenticated. Here is the exception I have at this line of the JSP page:

<         


        
相关标签:
1条回答
  • 2020-12-17 10:17

    You can just add one to your application context

    <bean id="webexpressionHandler" class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" /> 
    

    but the easiest way is just to enable expressions in your <http> configuration, and one will be added for you. This only means that you have to use expressions within that block, not in Java code such as method @Secured annotations.

    0 讨论(0)
提交回复
热议问题