spring boot使用spring boot security登陆时报错There is no PasswordEncoder mapped for the id "null"
程序员文章站
2022-04-14 22:42:45
...
出现该错误是因为密码加密问题,需要在securityConfig配置类中配置
@Autowired
UserDetailsService userDetailsService;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{
auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
}
@Bean
public static NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}