spring boot使用spring boot security登陆时报错There is no PasswordEncoder mapped for the id "null"

出现该错误是因为密码加密问题,需要在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();
    }
spring boot使用spring boot security登陆时报错There is no PasswordEncoder mapped for the id

你可能感兴趣的:(spring boot使用spring boot security登陆时报错There is no PasswordEncoder mapped for the id "null")