spring boot 整合security报错:There is no PasswordEncoder mapped for the id "null"

版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/imHanweihu/article/details/81585804

spring security报错:There is no PasswordEncoder mapped for the id "null"

1、问题描述:在写基于Spring cloud微服务的OAuth2认证服务时,因为Spring-Security从4+升级到5+

2、 解决方案:在security配置类中,添加

@Bean
public static NoOpPasswordEncoder passwordEncoder() {
    return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}

import org.springframework.security.crypto.password.NoOpPasswordEncoder;会显示失效,但可解决问题,亲测有效。

摘自:https://blog.csdn.net/dream_an/article/details/79381459

猜你喜欢

转载自blog.csdn.net/imHanweihu/article/details/81585804