我在 JSP 中显示属性文件中的某些属性,如下所示:
<spring:eval expression="@propertyConfigurer.getProperty('myproperty')"/>
现在,我想在 <sec:authorize access="hasRole()/>
中使用相同的属性
<sec:authorize access="hasRole('<spring:eval expression="@propertyConfigurer.getProperty('myproperty')"/>')">
这是行不通的。
最佳答案
试试这个:
<spring:eval expression="@propertyConfigurer.getProperty('myproperty')" var="myproperty"/>
<sec:authorize access="hasRole('${myproperty}')">
关于java - 使用 Spring :eval inside hasRole,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15115356/