You can use authorizeHttpRequests instead of authorizeRequests and requestMatchers instead of antMatchers.
For example:
http.authorizeHttpRequests()
.requestMatchers("/authentication/**").permitAll()
.requestMatchers("/h2/**").permitAll()
.anyRequest().authenticated();