【发布时间】:2013-10-19 06:16:51
【问题描述】:
有没有办法在 SpEL 表达式中访问会话对象?具体来说,我在 Spring Security 中需要它,比如
<intercept-url pattern="/somePage.html" access="session.getAttribute('someTemporaryFlag') != null" />
此代码返回:EL1008E:(pos 0): Field or property 'session' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot'。有一个与此相关的问题:List of Spring EL Variables 但它没有回答我的问题。
不接受具有安全角色的解决方案。
【问题讨论】:
-
提供的代码不适合您?
-
不,它返回 SpelEvaluationException
标签: java spring spring-security spring-el