Spring Security Oauth2.0 报错java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
原因:认证server里的auth.inMemoryAuthentication()里的密码不能直接写,需要加上BCryptPasswordEncoder的encode处理。修正后如下:
@Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // auth.parentAuthenticationManager(authenticationManager) auth.inMemoryAuthentication() .withUser("john").password(passwordEncoder().encode("123")).roles("USER"); } @Bean public BCryptPasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(); }