使用HttpSecutiry 同样要使用WebSecurityConfigurerAdapter类的重载,他重载的方法是configure(HttpSecurity http)
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("uuc").password("123").roles("admin")
.and()
.withUser("