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

Spring Security 无法登陆,报如下错误!

 auth.inMemoryAuthentication()
                .withUser("java1234")
                .password("123456")
                .roles("ADMIN");

Spring Security 无法登陆,报错:There is no PasswordEncoder mapped for the id “null”_第1张图片

使用如下代码就解决ok!

auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder()).withUser("java1234").password(new BCryptPasswordEncoder().encode("123456")).roles("ADMIN");

 

参考自:https://blog.csdn.net/canon_in_d_major/article/details/79675033

你可能感兴趣的:(SpringBoot)