我在pom.xml
<!-- SpringSecurity dependencies -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
我也在使用
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
我的问题只是我必须为USER和ADMIN显示两个不同的菜单
<ul id="menu_top">
<security:authorize access="hasRole('ROLE_ADMIN')">
<li><a href='<spring:url value="/admin/admin-stuff"/>'></a></li>
</security:authorize>
<security:authorize access="hasRole('ROLE_USER')">
<li><a href='<spring:url value="/user/user-stuff"/>'></a></li>
</security:authorize>
</ul>
这一切都不起作用意味着当我以ADMIN
登录或USER
没有显示任何内容时,我也尝试hasAuthority('ROLE_USER')
,但在这种情况下没有任何作用。