配置security:http有两种方式,视情况选用。
第一种:1
2
3<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/*" access="hasRole('ROLE_USER')"/>
</security:http>
第二种:1
2
3<security:http auto-config="true" use-expressions="false">
<security:intercept-url pattern="/*" access="ROLE_USER"/>
</security:http>
说明:
- use-expressions
1.trueaccess属性要使用表达式
2.falseaccess属性不能使用表达式