配置Spring Security 错误:Property or field 'ROLE_USER' cannot be found
在学习http://www.mkyong.com/spring-security/spring-security-hello-world-example/时,出现以下错误:
Property or field 'ROLE_USER' cannot be found on object of type 'org.springframework.security.web.access.expression.
经查发现把
<security:http auto-config="true">
<security:intercept-url pattern="/admin**" access="ROLE_USER" />
</security:http>
修改成:
<security:http auto-config="true">
<security:intercept-url pattern="/admin**" access="hasRole('ROLE_USER')" />
</security:http>
即可解决此问题,另由于我学习时使用的是4.0以上版本,还需要在所有的标签上加上security:
如<http></http>需要修改为<security:http></security:http>
配置Spring Security 错误:Property or field 'ROLE_USER' cannot be found的更多相关文章
- springboot配置spring security 静态资源不能访问
在springboot整合spring security 过程中曾遇到下面问题:(spring boot 2.0以上版本 spring security 5.x (spring secur ...
- SpringSecurity操作指南-在SpringMVC项目上配置Spring Security
- Spring Security 入门(1-2)Spring Security - 从 配置例子例子 开始我们的学习历程
1.Spring Security 的配置文件 我们需要为 Spring Security 专门建立一个 Spring 的配置文件,该文件就专门用来作为 Spring Security 的配置. &l ...
- spring security 3.2 配置详解(结合数据库)
没事就来了解下spring security.网上找了很多资料.有过时的,也有不是很全面的.各种问题也算是让我碰了个遍.这样吧.我先把整个流程写下来,之后在各个易混点分析吧. 1.建立几个必要的页面. ...
- Spring Security Oauth2 的配置
使用oauth2保护你的应用,可以分为简易的分为三个步骤 配置资源服务器 配置认证服务器 配置spring security 前两点是oauth2的主体内容,但前面我已经描述过了,spring sec ...
- spring boot rest 接口集成 spring security(1) - 最简配置
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...
- spring security 配置多个AuthenticationProvider
前言 发现很少关于spring security的文章,基本都是入门级的,配个UserServiceDetails或者配个路由控制就完事了,而且很多还是xml配置,国内通病...so,本文里的配置都是 ...
- Spring学习日志之Spring Security配置
依赖引入 <dependency> <groupId>org.springframework.security</groupId> <artifactId&g ...
- Spring Security(3):配置与自动配置的介绍及源码分析
基于注解的配置(Java Configuration)从Spring Security 3.2开始就已经支持,本篇基于Spring boot注解的配置进行讲解,如果需要基于XML配置(Security ...
随机推荐
- 3.5 compose redux sages
基于 redux-thunk 的实现特性,可以做到基于 promise 和递归的组合编排,而 redux-saga 提供了更容易的更高级的组合编排方式(当然这一切要归功于 Generator 特性), ...
- PAT_A1121#Damn Single
Source: PAT A1121 Damn Single (25 分) Description: "Damn Single (单身狗)" is the Chinese nickn ...
- Haproxy负载均衡/动静分离(haproxy各选项详细解释)
在前端领域做负载均衡,动静分离的程序有很多,比较常用的是nginx和Haproxy,今天就说一下 Haproxy在这两方面的表现,文章参考很多网文写成,再加上自己的实验成果,文中所有解释都经过实际环境 ...
- DFS问题举例:N个整数选k个使其和为x
N个整数选k个使其和为x,若有多个方案,选择元素平方和最大的一个 #include<cstdio> #include<cmath> #include<cstring> ...
- 37-Ubuntu-用户管理-02-查看用户信息
查看用户信息 序号 命令 作用 01 id 用户名 查看用户UID和GID信息 02 cat -n /etc/passwd 查看用户详细信息,参数-n显示行号 03 cat -n /etc/group ...
- ForEach控制器
ForEach一般是和用户定义的变量结合使用的 前面前缀一般是和用户定义的变量前缀一致 输出的变量是要使用的变量 这样能保证每次使用的变量不一样 add"_"before numb ...
- C#实体类克隆
public static T Clone<T>(T source) { if (!typeof(T).IsSerializable) { throw new ArgumentExcept ...
- Comparable和Comparator接口是干什么的?列出它们的区别
Java提供了只包含一个compareTo()方法的Comparable接口.这个方法可以个给两个对象排序.具体来说,它返回负数,0,正数来表明输入对象小于,等于,大于已经存在的对象. Java提供了 ...
- 过滤掉map集合中key或value为空的值
package cn.com.utils; import org.apache.commons.lang3.StringUtils; import java.util.Collection; impo ...
- python中模块和包的概念
1.模块 一个.py文件就是一个模块.这个文件的名字是:模块名.py.由此可见在python中,文件名和模块名的差别只是有没有后缀.有后缀是文件名,没有后缀是模块名. 每个文件(每个模块)都是一个独立 ...