配置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 ...
随机推荐
- 机器学习技法笔记:Homework #6 AdaBoost&Kernel Ridge Regression相关习题
原文地址:http://www.jianshu.com/p/9bf9e2add795 AdaBoost 问题描述 程序实现 # coding:utf-8 import math import nump ...
- 拾遗:Go 代码结构
#define @ $ 概述 Go 编码通常将所有代码放置在同一个工作区 一个工作区包含多个版本仓库,使用 Git 等工具控制 每个仓库包含一个或多个包 每个包由同一目录中的一份或多份源代码组成 包的 ...
- 面向对象(三)——组合、多态、封装、property装饰器
组合.多态.封装.property装饰器 一.组合 1.什么是组合 组合指的是某一个对象拥有一个属性,该属性的值是另外一个类的对象 class Foo(): pass class Bar(): pas ...
- 爬虫抓取5大门户网站和电商数据day1:基础环境搭建
最新想用爬虫实现抓取五大门户网站(搜狐.新浪.网易.腾讯.凤凰网)和电商数据(天猫,京东,聚美等), 今天第一天先搭建下环境和测试. 采用maven+xpath+ HttpClient+正则表达式. ...
- linux安装lolcat实现彩色文字输出信息
[root@localhost ~]# mount /dev/sr0 /media/[root@localhost ~]# rpm -ivh epel-release-latest-7.noarch. ...
- 检测apache状态,当apache处于非running状态如何脚本启动
编写脚本内容 #!/bin/bashURL="http://127.0.0.1/"curlit(){curl --connect-timeout 15 --max-time 20 ...
- Python自学:第五章 动手试一试 4-3
# -*- coding: GBK -*- numbers = ['] for number in numbers: print(number) 输出为: 1 2 3 4 5 6 7 8 9 10 1 ...
- rasa学习(domain.yml、nlu.md、stories.md)(一)
一. 什么是rasa Rasa是一个用于自动文本和基于语音的对话的开源机器学习框架.了解消息,保持对话以及连接到消息传递通道和API Rasa分为Rasa core和 Rasa nlu两部分: Ras ...
- scala中函数简单使用记录
object funcHighLevel { def main(args: Array[String]): Unit = { // 创建一个匿名函数 val sayFunc = (name: Stri ...
- Jmeter-【beanshell处理器】-随机获取手机号
一.通过操作变量 二.引用外部Java文件 三.引用外部class文件