是否可以将“hasRole”与属性占位符一起使用?

时间:2015-11-25 14:49:52

标签: spring-security

是否可以将“hasRole”与属性占位符的属性一起使用?我不能让这个工作。使用属性占位符中的属性可以很好地在applicationContext-security.xml中定义bean。

有关解决方法的任何提示吗?

我在日志中收到以下内容:

 INFO 25.11.2015 15:35:44:999 (FilterInvocationSecurityMetadataSourceParser.java:parseInterceptUrlsForFilterInvocationRequestMap:134) - Creating access control expression attribute 'hasRole('${myrole}')' for /protected.html

我使用以下xml:

    <s:intercept-url pattern="/protected.html" access="hasRole('${myrole}')" />

<context:property-placeholder location="classpath:project.properties"
    ignore-resource-not-found="false" ignore-unresolvable="true" order="1" />

我正在使用Spring 4.2.2.RELEASE和Spring security 3.2.8.RELEASE。

谢谢!

-Kaj:)

0 个答案:

没有答案