配置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 ...
随机推荐
- [转] bae中thinkphp的REWRITE 正确配置方法
URL_MODEL =2下. 官方的:app.conf不能用,害人呀.. 留意以下红色部分,正则要分开来写,坑爹的 正确的配置: handlers: handlers: - expire : .jpg ...
- 2.2 webpack
webpack 介绍 webpack 是什么 为什么引入新的打包工具 webpack 核心思想 webpack 安装 webpack 使用 命令行调用 配置文件 webpack 配置参数 entry ...
- 2、Android自动测试之Monkey工具
Android自动测试之Monkey工具 APP测试工作中经常会听到领导说,APP压力测试做了吗?刚入行时,不知道什么是 APP压力测试,找了半天没找到自己想要的.过了几年,回头想这个问题,发现牵扯了 ...
- RQNOJ PID4 数列
题目描述 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是: 1,3,4,9,10,12,13,… (该序列实际上就是 ...
- Python CookBook(self report)
Python CookBook 中文版:https://python3-cookbook.readthedocs.io/zh_CN/latest/copyright.html 英文版:https:// ...
- 基础补充(四)——流程控制之if、while、for,break与continue
流程控制 一.流程控制之if……else…… if 条件1: 缩进的代码块 elif 条件2: 缩进的代码块 elif 条件3: 缩进的代码块 ...... else: 缩进的代码块 二.流程控制之 ...
- docker container 的操作
删除所有退出的容器 docker container rm $(docker ps -aq)
- 44-Ubuntu-用户管理-09-chmod的数字表示法介绍
chmod 修改文件和目录权限 chmod在设置权限时,可以简单地使用三个数字分别对应拥有者/组和其他用户的权限. 注意: chmod直接修改文件|目录的'读|写|执行'权限,但是不能精确到拥有者|组 ...
- Logstash详解之——filter模块-grok插件
1. grok插件:能匹配一切数据,但是性能和对资源的损耗也很大. grok内置字段类型参见: https://blog.csdn.net/cui929434/article/details/9439 ...
- linux 下无法输入# 显示为£
在键盘布局里面,(Keyboard Layout)设置为中国,汉语.解决问题