目录
1.There is no PasswordEncoder mapped for the id “null”
解决方式:
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
2.AuthenticationManager注入报错
解决方式:
@Bean
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return super.authenticationManager();
}
3.security.basic.enable 过时问题
使用security.basic.enable=false 可以禁用Security默认认证,但是Spring Boot2.0以上版本集成Security 配置security.basic.enable已经过时了。如果我们想禁用默认的表单登录可以通过代码方式解决:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/**").permitAll();
}
}
陆续更新中。。