【发布时间】:2016-04-13 17:57:21
【问题描述】:
在我的控制器中,我试图在 Spring 注释中获取 system properties。这是代码
@PreAuthorize("hasPermission('${systemProperties['user.name']}', '')")
这是在抛出org.springframework.expression.spel.SpelParseException。
我试过了
@PreAuthorize("hasPermission('#{systemProperties['user.name']}', '')")
但结果相同exception
在 Spring 注解中获取系统属性的语法是什么?
【问题讨论】:
-
您不应该使用
#{systemProperties而不是${systemProperties吗? -
试过了,但得到了同样的异常
-
@Suganthan 尝试给出的示例并让我知道。在本地它有效,否则如果不正确,我将删除答案。
标签: java spring spring-mvc