配置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 ...
随机推荐
- JS基础复习
js基础语法 Netcape js基础语法规范(ECMAScript1,2,3,3.1,5(IE9),6 ES ES6=es2015) DOM BOM ...
- 1085 Perfect Sequence (25 分)
Given a sequence of positive integers and another positive integer p. The sequence is said to be a p ...
- redis 配置文件aof配置
redis 配置文件aof配置: bind 127.0.0.1 port 6379 daemonize yes dbfilename dump.rdb dir /new_renpeng/redis/ ...
- 详解Telecom
学习目标: 掌握Telecom入口和分析方法 总结和演进Telecom交互模型 掌握Listener消息回调机制 学习CallsManager 为什么选择Telecom分析? 这是由于在Android ...
- 深入vue
- 22-8-filter
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Redis 小调研
一. 概况: Redis是一款开源的.网络化的.基于内存的.可进行数据持久化的Key-Value存储系统.它的数据模型建立在外层,类似于其它结构化存储系统,是通过Key映射Value的方式来建立字典以 ...
- jq-demo-阻止冒泡,阻止默认行为
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- windows10,nodejs安装步骤
系统: windows10 1.下载: https://nodejs.org/en/ 2.下载最新版本,根据你的系统选择32位或者64位: 3.建议选择源码源码安装,不选择编译后的安装 如: 4.进行 ...
- 关于使用vue-router的嵌套路由的命名路由时踩的坑
今天在做我的模仿微博项目时,我想实现点击router-link后,跳转到微博正文页面,并渲染其嵌套视图-评论组件.但是在实际实现时,我发现页面可以正常跳转,但是在页面加载后,并不渲染该页面的嵌套视图, ...