What's the difference between these configurations:
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeHttpRequests().anyRequest().authenticated();
}
}
And
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.requestMatchers().and().authorizeHttpRequests().anyRequest().authenticated();
}
}
When should we use http.authorizeHttpRequests()
or http.requestMatchers()