查了下发现是spring security 版本在5.0后就要加个PasswordEncoder了

解决办法
  1. 在securityConfig类下加入NoOpPasswordEncoder,不过官方已经不推荐了
    @Bean
public static NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
  1. 在securityConfig类下加入密码加密,在数据库中存的密码也是要经过这个加密的才能匹配上
    @Autowired
private UserDetailsService customUserService; @Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(customUserService).passwordEncoder(new BCryptPasswordEncoder());
}

补充:加密操作

    public static void main(String[] args) {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
//加密"0"
String encode = bCryptPasswordEncoder.encode("0");
System.out.println(encode);
//结果:$2a$10$/eEV4X7hXPzYGzOLXfCizu6h7iRisp7I116wPA3P9uRcHAKJyY4TK
}

作者:yyq唯心不易
链接:https://www.jianshu.com/p/9e7792d767b2
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

Spring Security 报There is no PasswordEncoder mapped for the id "null"的更多相关文章

  1. spring security 5 There is no PasswordEncoder mapped for the id "null" 错误

    转载请注明出处 http://www.cnblogs.com/majianming/p/7923604.html 最近在学习spring security,但是在设置客户端密码时,一直出现了一下错误提 ...

  2. Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id “null”

    编写好继承了WebSecurityConfigurerAdapter类的WebSecurityConfig类后,我们需要在configure(AuthenticationManagerBuilder ...

  3. java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"报错

    出现问题的原因: 内存用户验证时,Spring boot 2.0.1引用的security 依赖是 spring security 5.X版本,此版本需要提供一个PasswordEncorder的实例 ...

  4. 005-SpringBoot2.x整合Security5(解决 There is no PasswordEncoder mapped for the id "null")

    问题描述 SpringBoot升级到了2.0之后的版本,Security也由原来的版本4升级到了5 使用WebSecurityConfigurerAdapter继承重置方法 protected voi ...

  5. There is no PasswordEncoder mapped for the id "null"的解决办法

    今日在SpringBoot项目中使用 Spring Security ,登录时发现报500错,报错信息如下: There is no PasswordEncoder mapped for the id ...

  6. java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"

    问题描述 今天在使用SpringBoot整合spring security,使用内存用户验证,但无响应报错:java.lang.IllegalArgumentException: There is n ...

  7. There is no PasswordEncoder mapped for the id "null"

    There is no PasswordEncoder mapped for the id "null" 学习了:https://blog.csdn.net/dream_an/ar ...

  8. SpringBoot整合升级Spring Security 报错 【The request was rejected because the URL was not normalized】

    前言 最近LZ给项目框架升级, 从Spring1.x升级到Spring2.x, 在这里就不多赘述两个版本之间的区别以及升级的原因. 关于升级过程中踩的坑,在其他博文中会做比较详细的记录,以便给读者参考 ...

  9. oauth2(spring security)报错method_not_allowed(Request method 'GET' not supported)解决方法

    报错信息 <MethodNotAllowed> <error>method_not_allowed</error> <error_description> ...

随机推荐

  1. JavaScript数组知识

    JavaScript数组知识 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  2. 用slot和component实现表单共用

    业务需求 在oa开发中,有许多流程,每个流程里都会有很多字段,比如流程标题.拉下选择,附件等等,有些是每个流程都会有的,有些是特有的,按常规的方法开发,就为为一个流程写一个表单,校验,提交.如果新来流 ...

  3. java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter的解决方案

    白天在实验室的电脑上的项目搭起来,晚上回到宿舍发现跑不起来了,网上查到的大多不是想要的答案. 最终的解决方案是maven clean一下再重新package.

  4. python网络爬虫(1)静态网页抓取

    获取响应内容: import requests r=requests.get('http://www.santostang.com/') print(r.encoding) print(r.statu ...

  5. 虚机Linux最小系统下安装图形界面,与yum配置

    出于未知原因,想装一下. 因为有光盘,所以就从光盘安装就可以了. 首先是配置yum下的下载地址: 找到yum的地址,然后打开文件. 然后建立该文件的/media/cdrom路径.将光盘挂载到该路径下. ...

  6. Linux安装rabbitmq (解决guest无法登陆问题)

    安装Erlang wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm sudo rpm -Uvh ...

  7. c# task笔记

    class Program { //创建Task任务的三种方式(无返回值) static void Main(string[] args) { //方法一 Task task1 = new Task( ...

  8. linux 查看io

    有时系统卡,可能是io值使用满了导致 1.安装iostat yum install sysstat 2.查看io使用情况 iostat -dx 3.安装iotop yum install iotop ...

  9. SpringCloud系列(一):Eureka 注册中心

    在演示spring cloud之前得要知道我们为什么需要微服务框架. 先讲讲我的经历,以前我们做项目时所有功能都写在一起,只是做了分层(模型,数据,业务),所有业务逻辑都写在业务层,刚开始还好,等时间 ...

  10. 生成不带版本的jar包 不影响deploy

    1 How to build maven project without version? 工程pom中增加 <project> ... <build> ... <fin ...