Spring Security 问题:There is no PasswordEncoder mapped for the id "null"

 There is no PasswordEncoder mapped for the id "null"

问题是password 未加密 此处记录报错原因

使用下面方法可以解决该问题

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

也可使用BCrypt加密

@Bean
public BCryptPasswordEncoder passwordEncoder(){
  return new BCryptPasswordEncoder();
}

 

你可能感兴趣的:(Spring,Security,Spring,boot)