Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception java.lang


密码编码问题
没有对密码进行加密

@Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication()
                .withUser("root").password("123").roles("vip1","vip2","vip3")
                .and()
                .withUser("xiao").password("123").roles("vip1","vip2");
    }

解决方法,对密码经行加密

protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder())
                .withUser("root").password(new BCryptPasswordEncoder().encode("123")).roles("vip1","vip2","vip3")
                .and()
                .withUser("xiao").password(new BCryptPasswordEncoder().encode("123")).roles("vip1","vip2");
    }