在学习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的更多相关文章

  1. springboot配置spring security 静态资源不能访问

    在springboot整合spring security 过程中曾遇到下面问题:(spring boot 2.0以上版本   spring security 5.x    (spring  secur ...

  2. SpringSecurity操作指南-在SpringMVC项目上配置Spring Security

  3. Spring Security 入门(1-2)Spring Security - 从 配置例子例子 开始我们的学习历程

    1.Spring Security 的配置文件 我们需要为 Spring Security 专门建立一个 Spring 的配置文件,该文件就专门用来作为 Spring Security 的配置. &l ...

  4. spring security 3.2 配置详解(结合数据库)

    没事就来了解下spring security.网上找了很多资料.有过时的,也有不是很全面的.各种问题也算是让我碰了个遍.这样吧.我先把整个流程写下来,之后在各个易混点分析吧. 1.建立几个必要的页面. ...

  5. Spring Security Oauth2 的配置

    使用oauth2保护你的应用,可以分为简易的分为三个步骤 配置资源服务器 配置认证服务器 配置spring security 前两点是oauth2的主体内容,但前面我已经描述过了,spring sec ...

  6. spring boot rest 接口集成 spring security(1) - 最简配置

    Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...

  7. spring security 配置多个AuthenticationProvider

    前言 发现很少关于spring security的文章,基本都是入门级的,配个UserServiceDetails或者配个路由控制就完事了,而且很多还是xml配置,国内通病...so,本文里的配置都是 ...

  8. Spring学习日志之Spring Security配置

    依赖引入 <dependency> <groupId>org.springframework.security</groupId> <artifactId&g ...

  9. Spring Security(3):配置与自动配置的介绍及源码分析

    基于注解的配置(Java Configuration)从Spring Security 3.2开始就已经支持,本篇基于Spring boot注解的配置进行讲解,如果需要基于XML配置(Security ...

随机推荐

  1. Access数据库中自动编号字段重置为1

    在清空一张ACESS数据库表后,在重添加数据之前,希望此表的自动编号能从1开始,怎么办呢? 下面的方法告诉我们,除了通过转存数据库表的方法外,还有几种更简单的方法: 方法一(前提:数据库表可带内容进行 ...

  2. 由Resin引发的java.lang.IllegalArgumentException: object is not an instance of declaring class(反射中使用)思考

    文章目录 背景 原因 解决办法 背景 在java agent中抓取Resin的 某些方法,在invoke的时候出现错误 java.lang.IllegalArgumentException: obje ...

  3. Java标准输入/输出/错误流

    只要使用OutputStream对象就可使用System.out和System.err对象引用.只要可以使用InputStream对象就可以使用System.in对象. System类提供了三个静态设 ...

  4. 移动APP和传统软件测试的区别[转载]

    目录 1. 移动App比PC 上的程序测试要复杂 2. 移动APP测试中如何设计Test Case 3. 让自己成为真实的用户 4. 关注用户体验测试 5. 少做UI自动化,多做后台接口的自动化 6. ...

  5. ThinkPHP5实用的数据库操作方法

    1.update方法总结 /** * 设置记录的某个字段值 * 支持使用数据库字段和方法 * @access public * @param string|array $field 字段名 * @pa ...

  6. ThinkPHP5验证码不显示的原因及解决方法

    其实很久之前刚学习tp5框架的时候就遇到了这个问题,解决完后一直没再出过问题,今天用以前的框架做新项目时又碰到了这个问题,这里记录一下 问题原因: 1.TP5本就存在这个bug 2.数据库连接不正常( ...

  7. 转载:mysql sql_safe_updates 分析

    今天看到一个很实用的功能,mysql_safe_updates. 只是对功能做了转载,具体原理可以看一下 delete from table t where true ; update t set c ...

  8. vue生态系统之vue-router

    一.vue-router安装与使用 1.安装 进入项目目录中安装vue-router模块 E:\vueProject\webpackProject>cnpm install vue-router ...

  9. ajax 工作原理

    Ajax的优缺点及工作原理? 定义和用法: AJAX = Asynchronous JavaScript and XML(异步的 JavaScript 和 XML).Ajax 是一种用于创建快速动态网 ...

  10. 小程序怎样将字符串转化为html

    在小程序中通过rich-text 标签,使用nodes将字符串转化为html <rich-text class="allAnswer "  nodes='<span c ...